Hi,

k deepthi wrote:
Can anyone please help me how to resolve the issue of replacing a statement in 
PDF using PDFBox. Please find the below loop mail.
I didn't test it but have a look at the example at [1]

BR
Andreas Lehmkühler

[1] http://svn.apache.org/repos/asf/incubator/pdfbox/trunk/src/main/java/org/apache/pdfbox/examples/pdmodel/ReplaceString.java

Regards
Deepthi.

--- On Tue, 3/11/09, a...@swmc.com <a...@swmc.com> wrote:


From: a...@swmc.com <a...@swmc.com>
Subject: Re: Regarding merging pdfs
To: pdfbox-users@incubator.apache.org
Cc: pdfbox-users@incubator.apache.org
Date: Tuesday, 3 November, 2009, 9:30 PM


I haven't done any text extraction nor insertion.

--Adam




k deepthi <kdeeps...@yahoo.co.in> 11/03/2009 04:38
Please respond to
pdfbox-users@incubator.apache.org


To
pdfbox-users@incubator.apache.org
cc

Subject
Re: Regarding merging pdfs






Hi Adam,
I am able to merge the pdfs.Thankyou. But the problem is the pdfs that are merged are generated by our tool with page number string as below at right end of the page.

eg: "INFORMATION Page 5 of 7" How can I replace the whole string with correct page numbers using PDFBox. Is there any method to replace tokens of string with another string.

Regards
Deepthi.



--- On Fri, 30/10/09, a...@swmc.com <a...@swmc.com> wrote:


From: a...@swmc.com <a...@swmc.com>
Subject: Re: Regarding merging pdfs
To: pdfbox-users@incubator.apache.org
Cc: pdfbox-users@incubator.apache.org
Date: Friday, 30 October, 2009, 11:29 PM



I'm not sure what that exception means. I remove all security before trying to save (as I want an unencrypted document as my final output), and I write to a FileOutputStream instead of passing in a String.
        doc.setAllSecurityToBeRemoved(true);
        doc.save(fos);

Removing security hasn't been included in any releases yet (or even HEAD tag), so if you want that functionality, you'll need to patch it and build yourself. https://issues.apache.org/jira/browse/PDFBOX-526 Also, your documents are never closed if an exception is thrown. That is bad. They should be closed in a "finally" block. And last, I don't think you need a parsers at all, this should be enough:
doc = new PDDocument("D:/MainDoc.pdf");

--Adam







k deepthi <kdeeps...@yahoo.co.in>
10/30/2009 00:29




Please respond to
pdfbox-users@incubator.apache.org






To
pdfbox-users@incubator.apache.org


cc



Subject
Re: Regarding merging pdfs













Hi Adam,
I have tried to create the same logic. But I am unable to save the output file. Please find the attachment of the file . I am using Apache PDFBox -- Version 0.8.0-incubating. The exception thrown is:

Output:

Else J and insertPageAt ---1 2
J and insertPageAt ---2 2
Else J and insertPageAt ---3 2 mainDoc total pages-----3 org.apache.pdfbox.exceptions.COSVisitorException: The handle is invalid at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:939) at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:201) at org.apache.pdfbox.cos.COSObject.accept(COSObject.java:206) at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:430) at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:361) at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:768) at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:379) at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1070) at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:893) at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:874) at com.ge.sample.fotopdf.PDFBoxSplitPdf.main(PDFBoxSplitPdf.java:48) java.io.IOException: The handle is invalid at java.io.RandomAccessFile.seek(Native Method) at org.apache.pdfbox.io.RandomAccessFile.seek(RandomAccessFile.java:59) at org.apache.pdfbox.io.RandomAccessFileInputStream.read(RandomAccessFileInputStream.java:96) at java.io.BufferedInputStream.fill(Unknown Source) at java.io.BufferedInputStream.read1(Unknown Source) at java.io.BufferedInputStream.read(Unknown Source) at org.apache.pdfbox.pdfwriter.COSWriter.visitFromStream(COSWriter.java:926) at org.apache.pdfbox.cos.COSStream.accept(COSStream.java:201) at org.apache.pdfbox.cos.COSObject.accept(COSObject.java:206) at org.apache.pdfbox.pdfwriter.COSWriter.doWriteObject(COSWriter.java:430) at org.apache.pdfbox.pdfwriter.COSWriter.doWriteBody(COSWriter.java:361) at org.apache.pdfbox.pdfwriter.COSWriter.visitFromDocument(COSWriter.java:768) at org.apache.pdfbox.cos.COSDocument.accept(COSDocument.java:379) at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1070) at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:893) at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:874) at com.ge.sample.fotopdf.PDFBoxSplitPdf.main(PDFBoxSplitPdf.java:48)

Please suggest me where I was wrong. The new document is creating the pages. But it is not getting saved in the pdf file.

Regards
Deepthi.

--- On Thu, 29/10/09, a...@swmc.com <a...@swmc.com>wrote:

From: a...@swmc.com <a...@swmc.com>
Subject: Re: Regarding merging pdfs
To: pdfbox-users@incubator.apache.org
Cc: pdfbox-users@incubator.apache.org
Date: Thursday, 29 October, 2009, 9:29 PM

Get the pages one at a time, and then write them to a new document in the desired order. IIRC, getPages() is in the PDDocument class.

--Adam




k deepthi <kdeeps...@yahoo.co.in> 10/29/2009 02:01
Please respond to
pdfbox-users@incubator.apache.org


To
pdfbox-users@incubator.apache.org
cc

Subject
Regarding merging pdfs






Hi,
I have two pdfs . One pdf with more than one page. Another with only one page. I have to add this page to the first pdf at 3rd page. Can anyone suggest me the solution how to do it.

Regards
Deepthi.


Try the new Yahoo! India Homepage. Click here. http://in.yahoo.com/trynew ? Click here to submit conditions This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.


Add whatever you love to the Yahoo! India homepage. Try now!


〉 Click here to submit conditions This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.

Connect more, do more and share more with Yahoo! India Mail. Learn more. http://in.overview.mail.yahoo.com/ 〉 Click here to submit conditions This email and any content within or attached hereto from Sun West Mortgage Company, Inc. is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named on this email. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on the contents of this email information is strictly prohibited, and that the documents should be returned to this office immediately by email. Receipt by anyone other than the intended recipient is not a waiver of any privilege. Please do not include your social security number, account number, or any other personal or financial information in the content of the email. Should you have any questions, please call (800) 453 7884.

      Add whatever you love to the Yahoo! India homepage. Try now! 
http://in.yahoo.com/trynew

Reply via email to