次のコードを使用して、iTextSharp SelectPDFを使用して大きなHTMLコンテンツをPDFに変換しています。いずれのHTMLページも正しく変換されません。データは6ページ後にPDFには消えます。すべてのHTMLページがSelectPdfでPDFに変換されない
public static void CreatePDFFromHTMLFile(string HtmlStream, string FileName)
{
try
{
// read parameters from the webpage
string htmlString = HtmlStream;
string baseUrl = "";
string pdf_page_size = "A4";
PdfPageSize pageSize = (PdfPageSize)Enum.Parse(typeof(PdfPageSize),
pdf_page_size, true);
string pdf_orientation = "Portrait";
PdfPageOrientation pdfOrientation =
(PdfPageOrientation)Enum.Parse(typeof(PdfPageOrientation),
pdf_orientation, true);
int webPageWidth = 1024;
int webPageHeight = 0;
HtmlToPdf converter = new HtmlToPdf();
// set converter options
converter.Options.PdfPageSize = pageSize;
converter.Options.PdfPageOrientation = pdfOrientation;
converter.Options.WebPageWidth = webPageWidth;
converter.Options.WebPageHeight = webPageHeight;
// create a new pdf document converting an url
PdfDocument doc = converter.ConvertHtmlString(htmlString, baseUrl);
doc.Save(FileName);
doc.Close();
}
catch (Exception ex)
{
Tracing.HandleException(ex);
}
}
は、したがって、あなたの質問には、iTextの質問として表示すべきではない、iTextSharpには 'HtmlToPdf'クラスはありません。私は 'HtmlToPdf'が何であるか分かりません(iTextSharpにそのようなクラスが存在するなら、私はiTextの元の開発者です)。また、あなたがHTMLを共有していない場合、答えを期待しないでください。 –
私にSelectPDFのように見えます:http://selectpdf.com/html-to-pdf/demo/convert-html-code-to-pdf.aspxタグを更新します。私の編集Brunoを承認できますか? –
OPはSelectPDFの現在のユーザーですが、それに満足していないのでしょうか?たぶん、彼らはiTextに切り替えたいと思ってテクニカルサポートをプロービングしていますか? –