Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I took all the information provided, wrote the following simple unit test method and ran it.</p> <pre><code>public void test19192108() { PDFWriter mPDFWriter = new PDFWriter(PaperSize.FOLIO_WIDTH, PaperSize.FOLIO_HEIGHT); mPDFWriter.setFont(StandardFonts.SUBTYPE, StandardFonts.COURIER, StandardFonts.WIN_ANSI_ENCODING); mPDFWriter.addText(170, 50, 40,"Coração"); String pdfcontent = mPDFWriter.asString(); outputToFile("helloworld19192108.pdf",pdfcontent,"ISO-8859-1"); } </code></pre> <p>(<code>outputToFile</code>being the helper method from the APW <code>PDFWriterDemo</code> class)</p> <p>The result looks like this:</p> <p><img src="https://i.stack.imgur.com/1wyE7.png" alt="Screenshot of helloworld19192108.pdf in Adobe Reader"></p> <p>This seems pretty much to fulfill the expectations.</p> <p>Thus, in whichever way <em>it doesn't work with some special characters(portuguese)</em> for the OP, some vital information is missing for reproducing the issue.</p> <p>PS: Depending on the setup of the development environment, there might be an issue with non-ASCII characters in the source code. Thus, it might be a good idea to replace </p> <pre><code> mPDFWriter.addText(170, 50, 40,"Coração"); </code></pre> <p>with</p> <pre><code> mPDFWriter.addText(170, 50, 40,"Cora\u00e7\u00e3o"); </code></pre> <p>PPS: Adobe Reader after viewing a file generated like this wants to repair it. The reason is that the cross reference table is broken. The code generating entries for it is this:</p> <pre><code>public void addObjectXRefInfo(int ByteOffset, int Generation, boolean InUse) { StringBuilder sb = new StringBuilder(); sb.append(String.format("%010d", ByteOffset)); sb.append(" "); sb.append(String.format("%05d", Generation)); if (InUse) { sb.append(" n "); } else { sb.append(" f "); } sb.append("\r\n"); mList.add(sb.toString()); } </code></pre> <blockquote> <p><em>(from <a href="http://sourceforge.net/p/apwlibrary/code/11/tree/CrossReferenceTable.java" rel="nofollow noreferrer">CrossReferenceTable.java</a>)</em></p> </blockquote> <p>Counting the characters in this entry we get 10 + 1 + 5 + 3 + 2 = 21.</p> <p>According to the specification, though:</p> <blockquote> <p>Each entry shall be exactly 20 bytes long, including the end-of-line marker</p> <p><em>(from section 7.5.4</em> Cross-Reference Table <em>of <a href="http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf" rel="nofollow noreferrer">ISO 32000-1</a>)</em></p> </blockquote> <p>When using (the current version of) the Android PDF Writer, you should fix this code, too.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload