I could not see, how to set the encoding of the bookmarks. If I create a bookmark like ‘Schriftsätze’ the resulting pdf contains something like ‘Schrifts#&stze’.
best regards
Arne
Hi Arne,
//create BookmarkEditor object and bind
PDF<o:p></o:p>
PdfBookmarkEditor editor = new PdfBookmarkEditor();
editor.bindPdf("d:/pdftest/Sample.Signed.pdf");
//create Bookmark object and set appropriate attributes
Bookmark bm11 = new Bookmark();
bm11.setAction("GoTo");
bm11.setDestination("wen");
bm11.setTitle("firstchildoffirstchild");
//create another bookmark
Bookmark bm1 = new Bookmark();
bm1.setPageNumber(1);
bm1.setTitle("firstchild");
//create a list and add bookmarks in it
ArrayList aList1 = new ArrayList();
aList1.add(bm11);
bm1.setChildItem(aList1);
Bookmark bm2 = new Bookmark();
bm2.setPageNumber(2);
bm2.setTitle("secondchild");
Bookmark bm = new Bookmark();
bm.setPageNumber(1);
bm.setTitle("Schriftsätze");
ArrayList aList = new ArrayList();
aList.add(bm1);
aList.add(bm2);
bm.setChildItem(aList);
//create bookmarks in the PDF file
editor.createBookmarks(bm);
//save output PDF file
editor.save("d:/pdftest/testCreateBookmarksOut.pdf");
Hi codewarior
Hi Arne,
I think there is one simple solution
System.setProperty("file.encoding", "ISO_8859_1");
work either, so I guess you make a getBytes call, wich is intended to be encoded in ISO_8859_1. I dont really want to set the default encoding in our whole project to ISO_8859_1, but I think if you will call
string.getBytes("ISO_8859_1");
instead of
string.getBytes();
that will solve the problem
best regards
Arne
Hi Arne,
PdfBookmarkEditor editor = new PdfBookmarkEditor();
editor.bindPdf("c:/pdftest/dok.pdf");
//create Bookmark object and set appropriate attributes
com.aspose.pdf.kit.Bookmark bm11 = new com.aspose.pdf.kit.Bookmark();
bm11.setAction("GoTo");
bm11.setDestination("wen");
bm11.setTitle("firstchildoffirstchild");
//create another bookmark
com.aspose.pdf.kit.Bookmark bm1 = new com.aspose.pdf.kit.Bookmark();
bm1.setPageNumber(1);
bm1.setTitle("firstchild");
//create a list and add bookmarks in it
ArrayList aList1 = new ArrayList();
aList1.add(bm11);
bm1.setChildItem(aList1);
Bookmark bm2 = new Bookmark();
bm2.setPageNumber(1);
bm2.setTitle("secondchild");
Bookmark bm = new Bookmark();
bm.setPageNumber(1);
bm.setTitle("Schriftsätze");
ArrayList aList = new ArrayList();
aList.add(bm1);
aList.add(bm2);
bm.setChildItem(aList);
//create bookmarks in the PDF file
editor.createBookmarks(bm);
//save output PDF file
editor.save(“c:/pdftest/testCreateBookmarksOut.pdf”);
Hi Codewarior
Hi Arne,
<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>For
the sake of correction, I have logged it in our issue tracking system as PDFKITJAVA-33276. We
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>
We apologize for your inconvenience.