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: Question about extract multiple line and table to PDF
Date Thu, 10 Nov 2016 16:47:27 GMT
Am 10.11.2016 um 17:23 schrieb Qi Gong:
> Hello Officer,
>
> My name is Qi Gong. I am working for US Food and Drug Administration. 
> I generate a software to do statistical analysis. We want to export 
> the report to PDF. Thus, we try to use your pdfbox to do it. The code 
> I use is like following:
>         PDDocument doc = new PDDocument();
>         PDPage page = new PDPage();
>         doc.addPage(page);
>         PDPageContentStream content = new PDPageContentStream(doc, page);
>         content.beginText();
>         content.setFont(PDType1Font.HELVETICA_BOLD, 18);
>         content.newLineAtOffset(100, 700);
>         content.showText(*our string*);
>         content.endText();
>         content.close();
>
> But I face some problems.
> 1. If the *our string* part is long. it with not automatically jump to 
> the next line. The string just disappear at boundary of the page.
> 2. If I use "\r\n" in *our string *to jump to next line, you package 
> gives me error like
> /    U+000D ('controlCR') is not available in this font Helvetica-Bold 
> (generic: Arial-BoldMT) encoding: WinAnsiEncoding/
>
> Thus, we want to know Is there any method to
> 1. let long string automatically jump to the next line.
> 2. Manually go to the next line
> 3. Export a table to the PDF.
>
> There is one example about what report PDF we want in attachment. It 
> generated by iTEXT. Do you think it is possible and not so hard to get 
> it by your pdfbox? Thank you.


Unlike itext, PDFBox is rather low level, so you must do such things 
yourself.

(PDF itself does not have a paragraph concept)

Re tables, have a look at boxable or tabula, which use PDFBox.

Tilman

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message