[
https://issues.apache.org/jira/browse/PDFBOX-3580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15682745#comment-15682745
]
Tilman Hausherr edited comment on PDFBOX-3580 at 11/21/16 7:08 AM:
-------------------------------------------------------------------
You need to create a new content stream for each page, write your stuff, close
it.
{code}
PDDocument doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage(page);
PDFont font = PDType1Font.HELVETICA_BOLD;
PDPageContentStream contents = new PDPageContentStream(doc, page);
contents.beginText();
contents.setFont(font, 12);
contents.newLineAtOffset(100, 700);
contents.showText("message text");
contents.endText();
contents.close();
doc.save(filename);
{code}
Try your code without the boxable stuff. Does it work now? If yes, then my work
is done. If not, please post your complete code (but without the boxable stuff)
and attach the result PDF.
Note that PDF coordinates start from the bottom, not from the top. So make sure
you're seeing the full page in your viewer.
was (Author: tilman):
You need to create a new content stream for each page, write your stuff, close
it.
{code}
PDDocument doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage(page);
PDFont font = PDType1Font.HELVETICA_BOLD;
PDPageContentStream contents = new PDPageContentStream(doc, page);
contents.beginText();
contents.setFont(font, 12);
contents.newLineAtOffset(100, 700);
contents.showText(message);
contents.endText();
contents.close();
doc.save(filename);
{code}
Try your code without the boxable stuff. Does it work now? If yes, then my work
is done. If not, please post your complete code (but without the boxable stuff)
and attach the result PDF.
Note that PDF coordinates start from the bottom, not from the top. So make sure
you're seeing the full page in your viewer.
> Not able to write content using PDPageContentStream while drawing BaseTable
> ---------------------------------------------------------------------------
>
> Key: PDFBOX-3580
> URL: https://issues.apache.org/jira/browse/PDFBOX-3580
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 2.0.1
> Environment: Windows 10 - 64 bit,
> Reporter: Varshal
>
> I am drawing BaseTable on a page where I am writing some content using
> PDPageContentStream on the same page.
> When I save this page, content is not stored on the page.
> Is it overwritten by BaseTable?
> The issue is not reflected when I use two different pages in same document.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]