Missing borders after PDF to PPTX conversion

Hello,

I’m trying to convert a PDF document to a PPTX, but some borders are missing after the conversion. Could you please confirm whether this is a bug in the library? Thank you

Document doc = Document("/path/to/borders.pdf");
doc.save(“/path/to/borders.pptx", SaveFormat.Pptx);

PDF and PPTX documents:
Archive.zip (43.0 KB)

Result:
result.png (132.8 KB)

@dfinsolutions

Issue Summary

You are converting a PDF that contains table‑like borders to PPTX using Aspose.PDF for Java:

Document doc = new Document("/path/to/borders.pdf");
doc.save("/path/to/borders.pptx", SaveFormat.Pptx);

After conversion some of the borders (lines separating cells) are missing in the generated PowerPoint file.

What to Expect from PDF → PPTX Conversion

Aspose.PDF tries to map PDF page objects to PowerPoint shapes. The conversion works well for most vector graphics, but there are a few known limitations:

PDF Element How it is mapped to PPTX Known limitation
Rectangles / lines that form table borders Converted to PowerPoint AutoShapes (lines, rectangles) Very thin lines, dashed patterns, or lines that are part of a complex clipping path may be ignored.
Table structures (PDF tables) Re‑created as a set of individual shapes, not as a PowerPoint table object. If the PDF uses “invisible” cell borders (e.g., borders with zero width or soft‑mask) they may be dropped.
Graphics state changes (e.g., opacity, blend modes) Mostly ignored because PPTX does not support the same rendering model. Borders drawn with non‑standard opacity can disappear.

Therefore, missing borders do not necessarily indicate a bug – they are usually a result of the conversion algorithm’s current capabilities.

Recommended Steps to Resolve / Minimise the Issue

  1. Upgrade to the latest Aspose.PDF for Java version
    The conversion engine is continuously improved. The most recent release (≥ 23.10) contains several fixes for line‑art handling.

    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-pdf</artifactId>
        <version>23.10</version>
    </dependency>
    
  2. Inspect the PDF for “invisible” borders
    Open the PDF in a PDF viewer that can show object properties (e.g., Adobe Acrobat → Print Production → Output Preview). Check if the borders are:

    • Zero‑width or have a very small line width (< 0.2 pt).
    • Drawn with a transparent stroke.

    If that’s the case, increase the line width in the source PDF (or ask the PDF creator to do so) and re‑run the conversion.

  3. Use PdfConvertOptions to control rendering
    While the PDF‑to‑PPTX API does not expose many switches, you can influence the overall rendering by adjusting the image‑based fallback:

    PdfConvertOptions options = new PdfConvertOptions();
    // Force rasterisation for pages that contain unsupported vector graphics
    options.setRasterizeUnsupportedObjects(true);
    // Optional: increase DPI for rasterised parts (helps to keep thin lines visible)
    options.setDpi(150);
    
    doc.save("/path/to/borders.pptx", SaveFormat.Pptx, options);
    

    When RasterizeUnsupportedObjects is true, any vector element that cannot be mapped to a PowerPoint shape is rendered as a bitmap, which guarantees that all visual details (including borders) are preserved.

  4. Post‑process with Aspose.Slides (if you need higher fidelity)
    If you require the borders to be editable PowerPoint shapes, you can:

    • Convert the PDF to images (one per page) using Aspose.PDF.
    • Insert each image as a slide background in Aspose.Slides.
    • Optionally overlay additional shapes if you need them to be vector‑based.
    // 1. Convert each PDF page to a high‑resolution PNG
    PdfConverter converter = new PdfConverter(doc);
    converter.setResolution(300);
    List<Image> pageImages = new ArrayList<>();
    for (int i = 1; i <= doc.getPages().size(); i++) {
        ByteArrayOutputStream imgStream = new ByteArrayOutputStream();
        doc.getPages().get_Item(i).convertToImage(ImageFormat.Png, imgStream);
        pageImages.add(ImageIO.read(new ByteArrayInputStream(imgStream.toByteArray())));
    }
    
    // 2. Create a PPTX with Aspose.Slides
    Presentation pres = new Presentation();
    for (Image img : pageImages) {
        ISlide slide = pres.getSlides().addEmptySlide(pres.getSlides().get_Item(0).getLayoutSlide());
        slide.getBackground().setType(BackgroundType.OwnBackground);
        slide.getBackground().getFillFormat().setFillType(FillType.Picture);
        slide.getBackground().getFillFormat().getPictureFillFormat().getPicture().setImage(pres.getImages().addImage(img));
    }
    pres.save("borders.pptx", SaveFormat.Pptx);
    

    This approach guarantees visual fidelity at the cost of editability.

  5. Provide a Minimal Re‑producible Sample (if the problem persists)
    If after trying the steps above the borders are still missing, please share:

    • The exact Aspose.PDF for Java version you are using.
    • A single‑page PDF that reproduces the missing‑border issue (you can strip unrelated pages).
    • The conversion code (including any custom PdfConvertOptions).

    With that information we can investigate further and determine whether a defect needs to be logged.

Useful Documentation Links


Next steps

  1. Update to the latest library version.
  2. Verify the border line width / opacity in the source PDF.
  3. Try conversion with PdfConvertOptions.setRasterizeUnsupportedObjects(true).
  4. If the problem remains, send the minimal PDF sample and the library version.

Feel free to ask if you need a code snippet for any of the steps above. Happy coding!

Hi, @dfinsolutions!
Could you please add more details? Which version of Aspose.PDF, OS, and Java are you using? I’m asking because I tested it on Aspose.PDF v25.8 and got the correct result.
borders_v25_8.zip (9.4 KB)