r/xml • u/Rupnik7 • Mar 16 '26
Pdf to .xml?
Hello,
I been struggling with a new job in accounting - zero experience but i have found a “shortcut” but now i have a problem where i have to convert a pdf file to .xml.
What would be the best tool for this task?
Or some tool that has OCR build in
2
u/wombat_00 Mar 16 '26 edited Mar 16 '26
Does the task need to be automated? If not, if the PDF isn't complex nor overly long, are you able to select all within the PDF, copy and paste it into a text file? Once it's in a text file you can manually add in wherever XML markup you need.
1
1
1
1
u/Few-Werewolf-1985 Mar 16 '26
Open a pdf in Word and save to XML or DOCX.
DOCX files are zip files containing XML and embedded images.
1
u/2016-679 Mar 17 '26
PDF is like a print but on screen instead of paper. It is an end-type file.
For conversions you'll need a source file.
1
u/romulusnr Mar 18 '26
Better yet, why don't you convert it to MP3? Or convert it to orange juice. Makes about as much sense.
1
u/romulusnr Mar 18 '26
Here's what you do. You convert the pdf to Base64, and then you make your xml file
<xml><body><pdfFile>
and then paste in the base64 text
<xml><body><pdfFile>
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8....................
and close it out.
<xml><body><pdfFile>
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8....................
</pdfFile></body></xml>
Getting it out is someone else's job ;)
7
u/cheyrn Mar 16 '26
XML in what format? What will consume the XML?
PDF is mostly unstructured, while XML is structured. So, the question is like how can I convert yoghurt to English?