pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: How to manipulate a pdf object
Date Tue, 29 Mar 2016 19:08:36 GMT
Am 29.03.2016 um 20:46 schrieb Kevin Ternes:
> Maruan and Tilman,
> I think you have answered my question--that I am basically out of luck.
> I already ran one through the usual PDF-Tools Debugger but it did not tell me anything
that I thought was useful.  I also tried looking at the PDF under Acrobat's preflight.
> But here is the use case:
> I have a large number of PDF "templates" that in our usual business process, we use PDFBox
to load, set form field values, add images, merge, flatten, protect, . . .
> However, it turns out that the specification for many of these templates has changed
so that a piece of text needs to be moved slightly up, a cm to the left and have the font
size changed.  Then there are some places where someone drew lines around hundreds of form
checkboxes!!!  So while I'm at it I'd like to delete those lines and set the form field widgets
to have a border.
> I wanted to write a quick command line program to do this.

Likely won't be possible. What I do is to run the WriteDecodedDoc 
command line utility and then do the changes manually. However you need 
to understand the PDF operators and the sizes of the content streams 
should not change, i.e. all object positions must stay the same.

Alternatively, get Acrobat Professional.


> I estimate that to do this one-pdf-at-a-time would take 10-20 hours.  That would not
be a problem except that we don't have an intern.
> Any suggestions appreciated.
> -----Original Message-----
> From: Maruan Sahyoun [mailto:sahyoun@fileaffairs.de]
> Sent: Tuesday, March 29, 2016 1:06 PM
> To: users@pdfbox.apache.org
> Subject: Re: How to manipulate a pdf object
> Hi,
>> Am 29.03.2016 um 19:54 schrieb Kevin Ternes <KTernes@thegeneral.com>:
>> I have successfully updated form widgets on pre-existing PDFs.
>> But what about ordinary non-form objects like a box of text?  I can add NEW objects
to the PDPageContentStream.
>> But how do I even get a reference to an existing object?
> What is it that you are trying to achieve? You can parse an existing content stream and
look for individual tokens. But there is no guarantee that, what your are calling a box of
text, is treated like that in the PDF as there is no such concept. E.g. individual lines,
word, characters forming a word ... could be placed individually in different operations.
It even might not be text but a vector or bitmap image. Your best bet is to look into the
content using the PDFDebugger and see if you can identify the parts you are looking for.
> Maybe you can elaborate a little more on your use case.
> BR
> Maruan
>> Viewing the document in Acrobat does not give me a clue as to what the object might
even be called.
>> PDFBox-2.0.0
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org

To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

View raw message