Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
changing [2016/06/02 12:22] christian created |
changing [2016/09/24 08:05] (current) dokuadmin ↷ Page moved from pdf:changing to changing |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Changing existing PDFs ====== | ====== Changing existing PDFs ====== | ||
- | In order to change an existing PDF, the file has to be read with < | + | To change an existing PDF, the file has to be read with: |
+ | < | ||
+ | |||
+ | The file can then be converted | ||
+ | < | ||
+ | |||
+ | After changing things in '' | ||
+ | < | ||
+ | |||
+ | ===== Details ===== | ||
+ | |||
+ | The class PDF.File is for reading PDFs from files. It does so incrementally by just reading objects from disk when they are needed. On can see that in the PDFExplorer: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | where 729 of 125179 objects have been read. | ||
+ | |||
+ | The inital object read from a PDF is the ''/ | ||
+ | |||
+ | The cloning of the PDF is done in the '' | ||
+ | <code Smalltalk> | ||
+ | asDocument | ||
+ | "< | ||
+ | a new document with the same contents as the receiver for writing out the PDF later" | ||
+ | |||
+ | | newDocument info | | ||
+ | newDocument := Document new. | ||
+ | newDocument root: self trailer Root. | ||
+ | info := self trailer Info. | ||
+ | info at: #ModDate put: Timestamp now. | ||
+ | info at: #Producer put: PDF producerText. | ||
+ | newDocument info: info. | ||
+ | newDocument previousId: self trailer ID. | ||
+ | ^newDocument | ||
+ | </ | ||
+ | |||
+ | For the new document , we just take the ''/ | ||
+ | |||
+ | The ''/ | ||
+ | |||
+ | Finally, when writing the new document, all references from ''/ | ||
+ | |||
+ | In the demos 12 and 13 (package "PDF Development", |