简体   繁体   English

PHP:现有pdf转换为PDF / A

[英]PHP: Existant pdf to PDF/A

Hello Im I find pdfs hard to understand. 您好,我发现pdf难以理解。 I need to make existant pdf into pdf/a . 我需要将现有的pdf转换为pdf / a。 I tried with GhostScript, 我尝试了GhostScript,

'gs -dPDFA -dBATCH -dNOPAUSE -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 ... 'gs -dPDFA -dBATCH -dNOPAUSE -sProcessColorModel = DeviceCMYK -sDEVICE = pdfwrite -sPDFACompatibilityPolicy = 1 ...

But file gained alot in size. 但是文件的大小很多。 700kb to 14Mb. 700kb至14Mb。 Such size is not acceptable. 这样的大小是不可接受的。 I need alternative. 我需要另类。 anyone has any idea? 有人有什么主意吗?

You should not expect a command line tool to be able to convert PDF to PDF/A. 您不应期望命令行工具能够将PDF转换为PDF / A。 You should also not be surprised that a file grows in file size when you want to create a PDF/A document from a PDF. 当您要从PDF创建PDF / A文档时,如果文件大小增加,您也不会感到惊讶。

To create a PDF/A from a PDF, you need to: 要从PDF创建PDF / A,您需要:

  1. add XMP metadata, 添加XMP元数据,
  2. embed all fonts that were previously not embedded (usually you can't do this from the command line because you'll need to provide a path to a font file in case a font program isn't found), 嵌入以前未嵌入的所有字体(通常无法从命令行执行此操作,因为如果找不到字体程序,则需要提供字体文件的路径),
  3. add a color profile, 添加颜色配置文件,
  4. remove all encryption, 删除所有加密,
  5. remove JavaScript. 删除JavaScript。

Unless the requirement is to create PDF/A-3, you may also have to convert all attachments to PDF/A. 除非要求创建PDF / A-3,否则您可能还必须将所有附件转换为PDF / A。

Your question should be closed as off-topic as it does not contain a specific programming problem (eg some source code that we can fix). 您的问题应以离题的方式结束,因为它不包含特定的编程问题(例如,我们可以修复的某些源代码)。 It is a very broad question and your expectation that you can do this without understanding PDF is too optimistic. 这是一个非常广泛的问题,您期望在不了解PDF的情况下可以做到这一点过于乐观。

Your question also contains a contraction. 您的问题还包含收缩。 In the subject line you mention PHP and in the tags you mention iText. 在主题行中,您提到了PHP,在标签中,您提到了iText。 iText is not a PHP library and you don't mention iText in your question anywhere. iText不是PHP库,您在任何问题中都不会提及iText。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM