Convert to PDF without 3rd party DLL [closed]

馋奶兔 提交于 2019-12-25 18:37:02

问题


I am looking at creating my own custom DLL to convert anything I want to PDF (HTML, XML, docx, xls, etc.). I do not even know where to begin, because every time this question is asked, all answers just link to existing DLLs that do PDF conversions.

I understand the task is not a simple one, but can someone tell me how one might go about coding such a project?


回答1:


Andrew, it's not that the question is difficult (nor the answer). It's that most people know exactly how difficult this task is. But if you really want to do this, the methodology is simple.

Go to http://www.adobe.com/devnet/acrobat/overview.html and download the Adobe Acrobat SDK from this page. Part of this SDK is the PDF specification, which in its most recent iteration is an ISO standard (ISO 32000). This very lengthy document describes in minute detail how a PDF file is structured and what the laws are it has to obey to.

All that rests (I really try to contain my irony :-)) is to ingest any file format you want to support and convert the information in it into a valid PDF file. Writing good PDF files isn't rocket science - writing is always easier than reading because you control what you want to support and not.

Just keep in mind that PDFs are read by tens of different applications and that you'd better write something that obeys the rules very, very strictly. Test early and often. To test, use Adobe Acrobat because it's still more or less the gold standard. Secondly, get yourself a preflight application (such as callas pdfToolbox or Enfocus PitStop - watch it, I'm affiliated with callas) and preflight your PDF file against the PDF/A-1b standard. Specifically that one because it is very strict for the actual file structure. You'll get a number of errors that have to do with PDF/A compliancy, but if there is anything wrong with the structure of your file, you're likely to also get those errors reported.

Good luck!



来源:https://stackoverflow.com/questions/13847032/convert-to-pdf-without-3rd-party-dll

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!