1

EVOPDF を使用して HTML -> PDF 生成ファイルにいくつかの属性を設定しようとしています。

PdfDocumentInfo プロパティを設定するのはかなり簡単に思えます。ドキュメントで指定されているとおり: http://www.evopdf.com/help/azure-html-to-pdf/html/T_EvoPdf_HtmlToPdfClient_PdfDocumentInfo.htm

ただし、Adobe Acrobat Reader で [ファイル] -> [プロパティ] を表示すると、空のボックスが表示されます。また、Hex エディターもデータを見つけられません。

http://www.evopdf.com/download.aspxからダウンロードした「EvoHtmlToPdfDemo_VS2013」v6.4 ソリューションを試し ましたが、ソリューション全体に PdfDocumentInfo が見つかりません。そのため、ドキュメント プロパティの設定方法を示すデモ コードはありません。

以下の私のコードを参照してください

  var converter = new HtmlToPdfConverter();
        converter.ConversionDelay = 0;
        converter.ClipHtmlView = false;

        var paperSize = PaperSizeToSizeF(pPaperSize);
        var pdfPageOrientation = (pIsLandscape) ? PdfPageOrientation.Landscape : PdfPageOrientation.Portrait;
        converter.PdfDocumentOptions.PdfPageOrientation = pdfPageOrientation;
        converter.PdfDocumentOptions.PdfStandardSubset = PdfStandardSubset.Pdf_A_1b;

        //IMPORTANT FOR COMPLIANCE
        converter.PdfDocumentInfo.AuthorName = "Mike de Klerk";
        converter.PdfDocumentInfo.Title = "PDF/A-1b Test";
        converter.PdfDocumentInfo.Subject = "Testing generation of PDF/A-1b compliant file by EVOPDF library.";
        converter.PdfDocumentInfo.Keywords = "HTML, PDF, Converter, PDF/A-1b. compliance";
        converter.PdfDocumentInfo.CreatedDate = DateTime.Now;

編集

オブジェクトを使用するとき、EvoPdf.Document私はそれを成し遂げることができます。EvoPdf.HtmlToPdfConverterしかし、オブジェクトを使用してそれを行うことはできません。ただし、ほとんどのドキュメントではHtmlToPdfConverter. EvoPdf.Documentオブジェクトの使用法については、以下のコードを参照してください。

        // Create the PDF document where to add the HTML documents
        var pdfDocument = new Document();

        // Set license key received after purchase to use the converter in licensed mode
        // Leave it not set to use the converter in demo mode
        pdfDocument.LicenseKey = LicenseKey;
        pdfDocument.DocumentInformation.Author = "Mike de Klerk";
        pdfDocument.DocumentInformation.Title = "PDF/A-1b Test";
        pdfDocument.DocumentInformation.Subject = "Testing generation of PDF/A-1b compliant file by EVOPDF library.";
        pdfDocument.DocumentInformation.Keywords = "HTML, PDF, Converter, PDF/A-1b. compliance";
        pdfDocument.DocumentInformation.CreationDate = DateTime.Now;

編集2:

オブジェクトがありHtmlToPdfConverter.PdfDocumentOptions.DocumentObject.DocumentInformationます。ただし、DocumentObject変換前は null です。ドキュメントによると

変換中にコンバーターによって初期化された内部 Document オブジェクトへの参照

DocumentObject変換後に確かに存在し、変換後にDocumentInformationプロパティが設定されていないことを確認できます。

編集3:

また、DocumentInformation変換前/変換後のイベントを設定しても機能しないようです。

converter.PrepareRenderPdfPageEvent += (eventParams) =>
{
    converter.PdfDocumentOptions.DocumentObject.DocumentInformation.Author = "Mike de Klerk";
    converter.PdfDocumentOptions.DocumentObject.DocumentInformation.Title = "PDF/A-1b Test";
    converter.PdfDocumentOptions.DocumentObject.DocumentInformation.Subject = "Testing generation of PDF/A-1b compliant file by EVOPDF library.";
    converter.PdfDocumentOptions.DocumentObject.DocumentInformation.Keywords = "HTML, PDF, Converter, PDF/A-1b. compliance";
    converter.PdfDocumentOptions.DocumentObject.DocumentInformation.CreationDate = DateTime.Now;
};
converter.AfterRenderPdfPageEvent += (eventParams) =>
{
    eventParams.Page.Document.DocumentInformation.Author = "Mike de Klerk";
    eventParams.Page.Document.DocumentInformation.Title = "PDF/A-1b Test";
    eventParams.Page.Document.DocumentInformation.Subject = "Testing generation of PDF/A-1b compliant file by EVOPDF library.";
    eventParams.Page.Document.DocumentInformation.Keywords = "HTML, PDF, Converter, PDF/A-1b. compliance";
    eventParams.Page.Document.DocumentInformation.CreationDate = DateTime.Now;
};
converter.ConvertHtmlFileToStream(pContentHtmlFile, pOutputStream);

編集4:

Document最初にオブジェクトに変換し、次に設定し、出力ストリームにDocumentInformation書き込む場合でも機能しません。Documentここで可能な回避策が不足していると感じています...

        var documentObject = converter.ConvertHtmlFileToPdfDocumentObject(pContentHtmlFile);
        documentObject.DocumentInformation.Author = "Mike de Klerk";
        documentObject.DocumentInformation.Title = "PDF/A-1b Test";
        documentObject.DocumentInformation.Subject = "Testing generation of PDF/A-1b compliant file by EVOPDF library.";
        documentObject.DocumentInformation.Keywords = "HTML, PDF, Converter, PDF/A-1b. compliance";
        documentObject.DocumentInformation.CreationDate = DateTime.Now;
        documentObject.Save(pOutputStream);

編集5:

documentObject.DocumentInformation.Author = "Value";を行うと、セッターがあり、実際に設定されていると想定しました。しかし、そうではありません。したがって、これらの値をどこに設定しようとしているかは問題ではありません。彼らはただ記憶されていません。これはバグに違いありません。EvoPdf.DocumentInfoEvoPdf.PdfDocumentInfoクラスさえあるのはなぜですか?1 つは を使用しAuthorName、もう 1 つは を使用しAuthorます。そして、これらの違いの詳細。

4

3 に答える 3

0

EVO HTML to PDF Converter によって生成された PDF ドキュメントのプロデューサーを変更することはできません。このプロパティは読み取り専用です。

于 2015-09-11T12:27:41.323 に答える
0

作成者、タイトルなどのメタデータは、PDF/A-1b 準拠の PDF で XMP ストリームに書き込む必要があります。PDF/A で XMP メタデータを参照

EvoPdf は、XMP ストリームではないストリームにメタデータを書き込みます。したがって、PDf/A-1b 準拠のファイルを生成し、(非 XMP ストリーム) メタデータを追加すると、PDF/A-1b に準拠しないファイルが生成されます。そのため、ファイルのコンプライアンスを維持するために、メタデータは書き込まれません。

EvoPdf で生成された PDF/A-1b 準拠のファイルにメタデータを追加するのに役立つ Adob​​e XMP Toolkitがあります。しかし、EvoPdf での生成中にファイルが署名されている場合やパスワードで保護されている場合に、それが可能かどうかはわかりません。

于 2015-09-14T07:05:19.223 に答える
-1

問題は、PDF/A ドキュメントを作成していることです。この規格では、著者名を設定することはできません。

于 2015-09-11T13:35:20.473 に答える