Post by aifritz » 18 Sep 2018, 12:27
Hallo zusammen,
ich würde gerne in pdf-Dateien, so wie hier beschrieben
https://stackoverflow.com/questions/618 ... ript-9-01, den Text /CropBox um wandeln in z.B. /cROPBoX. Allerdings nicht von Hand per Editor, sondern mit Autohotkey.
To be more specific: it will not work for PDFs which come along with their own /CropBox already defined to specific values. A dirty hack around that is to change the string /CropBox for all pages where it is desired to /cROPBoX (or similar case-changing) with a text editor prior to running the above GS command. The case-change effectively "disarms" the cropbox setting (without changing any PDF object offsets invalidating the existing xref table) so it is no longer considered by PDF renderers.
Ich dachte in etwa so:
Code: Select all
VarSetCapacity(ThePdfText, -1 )
FileRead, ThePdfText, MeinepdfDatei.pdf
StringReplace, ThePdfText, ThePdfText, /CropBox, /cROPBoX, All
FileDelete, MeinepdfDatei.pdf
FileAppend, %ThePdfText%, MeinepdfDatei.pdf
ThePdfText := ""
Problem ist allerdings, dass die pdf-Datei danach nicht mehr lesbar ist. Mache ich es so wie beschrieben über z.B. Notepad++ funktioniert es.
(Probiere ich das gleiche über PSPad, lässt sich die Datei komischerweise nicht als pdf speichern)
Hat jemand eine Idee, wie das per ahk klappen könnte?
Hallo zusammen,
ich würde gerne in pdf-Dateien, so wie hier beschrieben [url]https://stackoverflow.com/questions/6183479/cropping-a-pdf-using-ghostscript-9-01,[/url] den Text /CropBox um wandeln in z.B. /cROPBoX. Allerdings nicht von Hand per Editor, sondern mit Autohotkey.
[quote]
To be more specific: it will not work for PDFs which come along with their own /CropBox already defined to specific values. A dirty hack around that is to change the string /CropBox for all pages where it is desired to /cROPBoX (or similar case-changing) with a text editor prior to running the above GS command. The case-change effectively "disarms" the cropbox setting (without changing any PDF object offsets invalidating the existing xref table) so it is no longer considered by PDF renderers.
[/quote]
Ich dachte in etwa so:
[code]
VarSetCapacity(ThePdfText, -1 )
FileRead, ThePdfText, MeinepdfDatei.pdf
StringReplace, ThePdfText, ThePdfText, /CropBox, /cROPBoX, All
FileDelete, MeinepdfDatei.pdf
FileAppend, %ThePdfText%, MeinepdfDatei.pdf
ThePdfText := ""
[/code]
Problem ist allerdings, dass die pdf-Datei danach nicht mehr lesbar ist. Mache ich es so wie beschrieben über z.B. Notepad++ funktioniert es.
(Probiere ich das gleiche über PSPad, lässt sich die Datei komischerweise nicht als pdf speichern)
Hat jemand eine Idee, wie das per ahk klappen könnte?