954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Editing a PDF using JAVA API PDFBox HELP!! :(

Hi

PLEASE HELP

I have a problem with my PDFBox API.
I am currently getting a PDF Document and then I want to add a string at location
0,0, when i try to save it , it is not saving the changes and it remains as it is.


The Following is the code used:

PDPage page = (PDPage) allPages.get(f);
                        System.out.println(page);
                        PDRectangle pageSize = page.findMediaBox();
                        float stringWidth = font.getStringWidth( ab );
                        float centeredPosition = (pageSize.getWidth() - (stringWidth*fontSize)/1000f)/2f;

                        PDPageContentStream contentStream = new PDPageContentStream(pdoc,page,true,true);
                        contentStream.beginText();
                        contentStream.setFont( font, fontSize );
                        //contentStream.addLine(10, 10, 10, 10);
                        contentStream.moveTextPositionByAmount(0 , 0);
                        contentStream.drawString( ab );
                        contentStream.endText();
                        contentStream.close();

                        pdoc.save("C:/1/1.pdf");
                        pdoc.close();
Bozog
Newbie Poster
3 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

The problem is not with the code that I am using

The problem is that what generate the PDFs is generating them in a V 1.2 format.

So I need to see if there is any solution for a V1.2 report

Bozog
Newbie Poster
3 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: