Getting odd bookmark names for merged pdf in microsoft edge for aspose pdf JAVA

I am using apsose pdf to merge a pdf and add bookmarks to it , but the bookmark names are coming correctly when viewed in chrome browser but is not working well with microsoft edge
Edge
image.png (112.2 KB)
Chrome
image.png (82.6 KB)

Logic is this

    private static void addBookmark(Document mergedDoc, String inputFile, int pageIndex) {
        OutlineItemCollection bookmark = new OutlineItemCollection(mergedDoc.getOutlines());
        bookmark.setTitle(StringUtils.substringBeforeLast(Paths.get(inputFile).getFileName().toString(), "."));
        bookmark.setBold(true);
        bookmark.setItalic(false);
        bookmark.setAction(new GoToAction(mergedDoc.getPages().get_Item(pageIndex)));
        mergedDoc.getOutlines().add(bookmark);
    }
1 Like

@chetanepiq

Summary
You are seeing correct bookmark titles in Chrome but odd or missing titles in Microsoft Edge after merging PDFs with Aspose.PDF.

Why it happens
Edge uses its own PDF viewer (based on PDF.js) which can interpret PDF outline entries differently than Chrome. If the bookmark titles contain characters that are not encoded in the PDF’s default text encoding, or if the outline objects are added without explicitly setting the document’s Unicode flag, Edge may fall back to a default or garbled name. Additionally, older versions of Aspose.PDF had bugs where outline titles were not written with proper UTF‑16 encoding, which manifested only in viewers that are stricter about the encoding (such as Edge).

What to do next

  1. Upgrade Aspose.PDF – Ensure you are using the latest stable version of Aspose.PDF for .NET, as recent releases (23.x and later) contain fixes for outline/bookmark encoding.
  2. Force Unicode encoding – Before adding outlines, set the document’s PdfDocumentInfo to use Unicode:
mergedDoc.Info.Title = "My Document"; // forces Unicode handling
mergedDoc.Info.Language = "en-US";

Then add the bookmark as you already do.
3. Validate the PDF – Open the merged file in a PDF validator (e.g., PDF/A‑1b checker) to confirm that the outline titles are stored as UTF‑16 strings.
4. Test in Edge – After rebuilding the PDF, open it in Edge. The titles should now appear correctly.
5. If the issue persists – Capture the PDF’s outline objects using a tool like pdfinfo or iText to inspect the raw title strings. Compare the output from Chrome and Edge to see if any characters are being stripped.
6. Contact Aspose Support – Provide them with a minimal reproducible sample, the exact Aspose.PDF version, and the PDFs that show the discrepancy. They can confirm whether it is a library bug or a viewer‑specific limitation.

Note: The evidence retrieved does not directly address this specific Edge bookmark issue, but the above steps are based on common causes of outline encoding problems in PDF viewers.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

SDK version unclear — refer to the official release notes before applying this guidance.

@Professionalize.Discourse we are using aspose-pdf , java library . version: 25.6.

could you share your recommendations to fix the problem?

I am using apsose pdf to merge a pdf and add bookmarks to it , but the bookmark names are coming correctly when viewed in chrome browser but is not working well with microsoft edge
Edge
image.png (1.4 KB)
Chrome
image.png (82.6 KB)

Logic is this

    private static void addBookmark(Document mergedDoc, String inputFile, int pageIndex) {
        OutlineItemCollection bookmark = new OutlineItemCollection(mergedDoc.getOutlines());
        bookmark.setTitle(StringUtils.substringBeforeLast(Paths.get(inputFile).getFileName().toString(), "."));
        bookmark.setBold(true);
        bookmark.setItalic(false);
        bookmark.setAction(new GoToAction(mergedDoc.getPages().get_Item(pageIndex)));
        mergedDoc.getOutlines().add(bookmark);
    }

@chetanepiq

I wasn’t able to locate any documentation or community posts that specifically address the difference you’re seeing between Chrome and Microsoft Edge when viewing bookmarks created with Aspose.PDF. The evidence retrieved (a discussion about MHTML content and a generic product list) does not cover this scenario, so the previous answer was largely speculative.

What this means

  • There is no publicly‑available reference that explains why Edge would display odd bookmark names while Chrome shows them correctly.
  • Without a concrete source, we can’t confirm whether the issue is caused by the PDF version, character encoding, a bug in Edge’s built‑in PDF viewer, or a particular Aspose.PDF version.

What you can do next

  1. Verify the Aspose.PDF version – Make sure you’re using the latest release; older versions had known issues with bookmark encoding.
  2. Check the PDF/A compliance – Saving the merged document as PDF/A (e.g., PdfSaveOptions with setCompliance(PdfCompliance.PDF_A_1B)) can sometimes normalize bookmark handling across viewers.
  3. Explicitly set Unicode encoding – If your file names contain non‑ASCII characters, ensure the title is encoded as Unicode, e.g., bookmark.setTitle(new String(title.getBytes("UTF-8"), "UTF-8"));.
  4. Test with a different PDF viewer – Open the merged PDF in Adobe Acrobat or another third‑party viewer to see if the bookmark names appear correctly. If they do, the problem is likely specific to Edge’s PDF renderer.
  5. Create a minimal reproducible example – Reduce the code to the smallest snippet that reproduces the issue and share it with Aspose support. Include the exact SDK version, .NET runtime, and a sample PDF.
  6. Report the behavior to Microsoft Edge – If the issue persists only in Edge, consider filing a bug with the Edge team, providing the problematic PDF for analysis.

Until a definitive source is found, the safest path is to verify the PDF generation settings and involve Aspose support with a minimal test case.

Note: This answer is based on the lack of relevant evidence in the retrieved sources, not on a confirmed solution.

:warning: I could not fully verify this explanation against the retrieved sources. Please double-check the behaviour in your environment and confirm the exact SDK/version.

This is a duplicate for this one

Getting odd bookmark names for merged pdf in microsoft edge for aspose pdf JAVA - Free Support Forum - aspose.com

1 Like

@divine1

Does Adobe Reader display the PDF correctly? Please note that Aspose.PDF adheres to Adobe Standards. Different PDF viewers may have unique settings for displaying PDF documents, which we unfortunately cannot control. If the issue also occurs with Adobe Reader, kindly share the complete sample code snippet along with the sample files so we can test the scenario in our environment and address it accordingly.

Adobe Reader is working fine with it, but can you please help to make it work for edge browser, seems to work fine for chrome browser also

1 Like