Announcement

Collapse
No announcement yet.

Problems with PDFBOX and merges

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with PDFBOX and merges

    Good afternoon
    Currently using PDFBOX to merge PDFs and due to the nature these PDFs are created - I am seeing errors when merging with a corresponding report in Mirth. This error is frequently popping up - Wrapped java.io.IOException: Error: Expected a long type at offset 203061

    This is the code I am using for my channel

  • #2
    Not sure what that issue is, but I recently put together a little proof-of-concept where I had to merge two PDF's myself that I got working. Maybe the following will help you/lead you to your solution. Unfortunately, this board will not let me past in my code for some reason, so ill have to screenshot it

    You do not have permission to view this gallery.
    This gallery has 1 photos.

    Comment


    • #3
      Thanks for that - it didn't let me post my code earlier but that is exactly what I have. At this point I'm beginning to think it doesn't like one of the PDFs. Don't suppose you know if there is a way to validate a PDF or even change the version using PDFBOX? Checked the forums but nothing so far has been visible.

      Comment


      • #4
        Would iText allow for PDF merging? PDFBOX doesnt seem to like the PDFs - I imagine Mirth would have more than one way for accomplishing this?

        Comment


        • #5
          Looking at the error in Google, it seems to indicate an issue with the PDF possibly, such as it being malformed, etc.

          Comment


          • #6
            Had a check - both PDFs are viewable in Acrobat. Its odd. I have switched to itext to see if I can merge the PDFs this way instead.

            Comment


            • #7
              Just curious, I have never merged pdf's but what is the goal here with the merge?
              Eg. I have 2 PDF's each with 1 page each, and I merge them so I get a new PDF with 2 pages, is that what it means?
              HL7v2.7 Certified Control Specialist!

              Comment


              • #8
                siddharth, yes. Perhaps the better word is "join" or "append" rather than merge.

                I use pdftk for that at the command line, so much faster. Then have mirth pick up the files post join.

                pdftk 1.pdf 2.pdf 3.pdf cat output joined.pdf
                Last edited by pacmano; 06-21-2022, 07:56 AM.
                Diridium Technologies, Inc.
                https://diridium.com

                Comment

                Working...
                X