> On 29 Jan 2016, at 12:55, Sumit Mohan Jha <[email protected]> > wrote: > > > > > The link to PDF with which i am facing trouble is: > http://www.megafileupload.com/ac8r/Second.pdf > > > Hi, My this email is related to my further questions related to solution > provided by Tilman for PDFBOX-3216 issue: > https://issues.apache.org/jira/browse/PDFBOX-3216# The solution provided by > Tilman is really good. The solution is working for some of PDF I am trying to > process but was facing some minor issues due to my requirement with some of > other PDF processing: My goal here is to read PDF (multiple PDF with > different original formatting and page size) and in each page of individual > PDF leave some fixed absolute blank space in top right corner so that later > some other application can put a bar code in that blank space. Also, that > some fixed absolute blank space left in top portion of PDF pages need to be > uniform across all the different source PDF file processed, so that other > application which is putting bar code will put same size bar code at same > location of different PDFs. I understand that if some PDF will already have > some more blank space in top compared to other PDF then converted PDF for > first will have more blank space in top compared to other. That is fine. But > how to ensure that after conversion both PDF will leave at least some fixed > absolute height area blank. If one is more than that absolute fixed height it > is ok. Now, to keep uniform blank space in all PDF processed, I had come up > with a sample code. Please see attached .java file for my sample code. I have > used Tilman sample code provided to come up with my sample code. Please see > attached some of my example source pdf files which I need to process through > PDFBOX 1.8.10 version and leave blank space at top in all these PDFs. The > challenge here now is to keep uniform some fixed absolute height area blank > in top of these 2 PDFs which are of different source formatting. 1. My code > work fine with attached First.pdf. 2. But when I am trying to process > Second.pdf, if I scale to 95% height only the converted PDF is good. But with > 90% converted PDF the content is truncated from bottom. For even less than > 90% scaling (like 80%) the converted pdf has blank page. If I scale in width > anything less than 100% the converted PDF is messed up. In the current code > the converted PDF is messing up due to width scaling. For height it is > leaving space in top. But it does not seems to be ensuring that blank space > in both converted PDF is at least some fixed absolute height area. In second > one it is quite less. What i need is a solution so that my converted pdfs > after scaling in height for both these source pdfs will leave at least some > fixed absolute height area blank. As I explained earlier if one is leaving > more than that fix absolute height is ok as source file already had more > blank space at top. If a little width scaling can be done too it will be > great as some source pdf which has text strating from at the very left margin > will also look good after conversion. But top priority is vertical scaling to > leave blank space in top. 3. Also, with my current code execution, i get > below warning message, please let me know how this warning message can be > avoided: Jan 28, 2016 5:49:29 PM > org.apache.pdfbox.pdmodel.edit.PDPageContentStream <init>WARNING: You are > overwriting an existing content, you should use the append mode Your any help > in this regard will be highly appreciated and I am looking forward for your > response on this. Thanks,Sumit Jha
What you could do is embed each page of the original PDF as a PDFormXObject, which is similar to an <iframe> in HTML, if you’re familiar with that. Then you can position the Form XObject where you wish on the page, and set its scaling and crop box. — John > -------- Original message -------- > From: Sumit Mohan Jha <[email protected]> > Date: 01/29/2016 12:30 PM (GMT-06:00) > To: [email protected] > Subject: Further questions related to PDFBOX-3216 Issue > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

