Giter VIP home page Giter VIP logo

aspose.pdf-for-.net's Introduction

Nuget Nuget GitHub

.NET API to Process & Manipulate PDF Files

Integrate PDF creation, processing, manipulation & conversion features into your own .NET applications without needing Adobe Acrobat®.

Aspose.PDF for .NET allows to work with PDF documents, pages, text, images, attachments, fonts, bookmarks, annotations, forms, operators, stamps, watermarks, links, security, signatures, and printing.

Directory Description
Demos Source code for the live demos hosted at https://products.aspose.app/pdf/family.
Docker Source code of examples based on Docker-containers.
Examples A collection of .NET examples that help you learn the product features.
Showcases Standalone ready-to-use applications that demonstrate some specific use cases.
Plugins Visual Studio plugins of Aspose.PDF for .NET.

PDF Processing via .NET

  • Generate PDF documents on the fly through the API or via XML templates.
  • Supports 14 core, Type 1, TruType, Type 3, CJK & Unicode fonts.
  • Extract text from PDF pages or search for particular text segment using regular expressions.
  • Add or extract text & images to & from PDF documents.
  • Concatenate or split PDF files.
  • Linearization of PDF documents for web optimization.
  • Validation support for PDF/A-1a, PDF/A-1b & PDF/A-2a.
  • Manage PDF tables & graphs using easy to understand object model.
  • Convert PDF documents to Office, web, image & PS formats with highest visual fidelity.
  • Manipulate PDF files to manage bookmarks, hyperlinks, watermarks, attachments & annotation.
  • Encrypt or decrypt PDF documents as well as set document privileges or modify passwords.
  • Manage PDF forms to add, delete, move, flatten or decorate form fields. Developers may also import or export XML, FDF or XFDF data.
  • Digitally sign PDF documents or remove signatures. Also, verify if PDF is signed and signature is valid.
  • Print PDF documents to physical or virtual printers with or without print dialog.
  • Set document viewer preferences as well as manipulate document information & XMP metadata.

Read & Write PDF & Other Formats

Fixed Layout: PDF, PDF/A, PDF/UA, XPS
Books: EPUB
Web: HTML, MHTML
Other: TEX, CGM, XSLFO, XML, PCL, SVG

Save PDF Documents As

Microsoft Office: DOC, DOCX, XLS, XLSX, PPTX
Images: JPEG, PNG, BMP, TIFF, EMF
Other: MobiXML, XML

Read Formats

PostScript: PS

Platform Independence

Aspose.PDF for .NET can be used to build applications for Windows, Mac OS X x64 as well as for Linux x64. Developers may also code in PHP, VBScript, Delphi & C++ programming languages while using Aspose.PDF for .NET via COM Interop.

Getting Started with Aspose.PDF for .NET

Are you ready to give Aspose.PDF for .NET a try? Simply execute Install-Package Aspose.PDF from Package Manager Console in Visual Studio to fetch the NuGet package. If you already have Aspose.PDF for .NET and want to upgrade the version, please execute Update-Package Aspose.PDF to get the latest version.

Create a PDF Document from Scratch

// initialize document object
Document document = new Document();
// add a page
Page page = document.Pages.Add();
// add text to the new page
page.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment("Hello World!"));
// save PDF document
document.Save(dir + "output.pdf");

Save PDF as Office & HTML Formats

One of the most popular feature of Aspose.PDF for .NET is to convert PDF documents to other formats without needing to understand the underlying structure of the resultant format.

Give the following snippet a try with your own samples:

// load the file to be converted
var pfile = new Aspose.Pdf.Document(dir + "template.pdf");
// save in different formats
pfile.Save(dir + "output.docx", Aspose.Pdf.SaveFormat.DocX);
pfile.Save(dir + "output.pptx", Aspose.Pdf.SaveFormat.Pptx);
pfile.Save(dir + "output.html", Aspose.Pdf.SaveFormat.Html);

Home | Product Page | Docs | Demos | API Reference | Examples | Blog | Search | Free Support | Temporary License

aspose.pdf-for-.net's People

Contributors

aliahmedaspose avatar andruhovski avatar anholub avatar arise-project avatar asadalikhan90 avatar babar-raza avatar dependabot[bot] avatar farooqsheikhpk avatar jeffbdye avatar kashifiqb avatar naeem244 avatar rizwanniazigroupdocs avatar saudaspose avatar valeriy-ten-aspose avatar valeriyten avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aspose.pdf-for-.net's Issues

PDF 1.4 Transparency

Hello, any plans to support PDF 1.4 Transparency (i.e. BM operator)? At least, I couldn't find it in the Aspose PDF API documentation.

Pdf editor canvas is not displaying.

I'm developing a project with Dot Net 7. In this project i am implementing new pdf editor.
Build in canvas is not displaying as well as the pdf file which has been uploaded is not showing also.
image

Issue with saveOptions and margins

Dear,

By exporting a document created by Aspose.Cells, I want to share an issue.

If you setup pageOptions margin with right and left borders at 0.1 the export is more at the left with a right border like 0.5 margin and a real 0.1 margin at the left.

As a workaround I setup both margin at 0.5 but this default behavior is weird.

Is it possible to review my issue ?

Regards

PROBLEM ON LINUX DEBIAN

If I run locally it works on Windows but just simple example with text hello world and it crashes always on document.Save

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'key')

Creating PDF from HTML which contains a non-breaking space fails

When attempting to create a PDF file from HTML text which contains a non-breaking space (i.e. the   entity) the Aspose.Pdf.Document constructor fails with a NullReferenceException.

Code to reproduce:

byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(" ");
using var stream = new System.IO.MemoryStream(byteArray);
var htmloptions = new Aspose.Pdf.HtmlLoadOptions();
var doc = new Aspose.Pdf.Document(stream, htmloptions); // Exception thrown here.

The thrown exception:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Aspose.Pdf.Text.Font..ctor(#=zNHBl9bv5dKBFxtt9xgExszk= #=zg4LwFFM=)
   at #=zrqioYeoeEV9SrAkxSuXwlXH5Ifyvlj21WdquE7oNTcGPoqO1Sd3yyi8=.#=zdLqnfTBuN$M4C$2UFip31dB2LdAV(String #=zpnc7MyM=, Font #=zg4LwFFM=, Font& #=zMKyPsWYDEY$fJObf78seVyY=)
   at #=zIQs01lavi4DNdBNklNx6bASPbgzf.#=zuuZIr3uS2Y4E(String #=z_RjUeeI=)
   at Aspose.Pdf.Text.TextFragment.#=zDBWFds67mVyS(String #=z_RjUeeI=)
   at Aspose.Pdf.Text.TextFragment..ctor(String text)
   at #=zvFFs2HgtA62UgDSLh9$2J$vjm0p28ZsJ8g==`1.#=zL7vLnoM=(String #=z_RjUeeI=, PointF #=zj_TlQ5M=)
   at #=z9Li_ajC7P2DH_9gNchZJecBNHI9O.#=z6cQnZaM=(#=zCxY5wubIdFpGMtJOQGw0OHGDaeJIVIRIVQ== #=zcBszi6J1fEZ$, Boolean #=zZdLctoCNtTZ4u74z5g==, #=zJ3vmM7qiKmHn5QQBWTwjvIV8T_SaaenURw== #=zRBCY2gg=)
   at #=z9Li_ajC7P2DH_9gNchZJecBNHI9O.#=zqs1Nsl_OwomM(#=zfWlGV7dhTUFkybysb8upcVwAqi55rK9z0Q== #=zeobQHR4=, Boolean #=zZdLctoCNtTZ4u74z5g==, #=zJ3vmM7qiKmHn5QQBWTwjvIV8T_SaaenURw== #=zRBCY2gg=)
   at #=z9Li_ajC7P2DH_9gNchZJecBNHI9O.#=zE_3gB4gFjgQw$OgACA==(#=zcsJAVB7XAc5g1Y_MdQ== #=z0wYF1JtChsr23LfchQ==, Boolean #=zZdLctoCNtTZ4u74z5g==, #=zJ3vmM7qiKmHn5QQBWTwjvIV8T_SaaenURw== #=zRBCY2gg=)
   at #=z9Li_ajC7P2DH_9gNchZJecBNHI9O.#=zP$TpPEg=(#=zRH8f$IrX5U5FK$jd4WhwBzOLZ0IU4zUhHg== #=zZPNcMZI=, #=z_Ngejrgt9PdYCaBxsQ== #=z0wYF1JtChsr23LfchQ==, Boolean #=zZdLctoCNtTZ4u74z5g==, #=zJ3vmM7qiKmHn5QQBWTwjvIV8T_SaaenURw== #=zRBCY2gg=)
   at #=zArJ$1ei6mH73KsCnFCJHuYXIh2MkH7ERo34xqoQ=.Render(#=zPadphowpHvLcFEFXuH_tOdDwZUYo #=zlu$sVVM=)
   at #=znzoTTXv3NQyq5K0RKul_Ti03pwpiGddQlw==.#=z_1H7pgLZitRn(#=zndSqXilF3Osog0Ga6DxD3V4= #=zuRs8sXEHxAzpoGSFYg==, #=zy00zKi9g6s2rlCYLyH22q3ntVMej[] #=zyUS41KSLWa6j, #=zcR9jE0eKS5zqmNI6sRXeq3ApV$1I #=z0BulzFY=, TimeSpan #=ze$_SWv4=)
   at #=zoJdleXCqLDG06fPZsfiAlUOoZkCB.Render(#=zcR9jE0eKS5zqmNI6sRXeq3ApV$1I #=z0BulzFY=, TimeSpan #=ze$_SWv4=, #=zvn9ALkUwdUVSXZ0I3BOPfIQ=[] #=zbJWDOj8=)
   at #=zE1ve9d8lC0QyRuf_nNrVnr54eeLb.Render(#=zcR9jE0eKS5zqmNI6sRXeq3ApV$1I #=z0BulzFY=, #=zLYSUhy8= #=zOBAXFmY=, TimeSpan #=ze$_SWv4=)
   at #=zE1ve9d8lC0QyRuf_nNrVnr54eeLb.Render(#=zcR9jE0eKS5zqmNI6sRXeq3ApV$1I #=z0BulzFY=, #=zLYSUhy8= #=zOBAXFmY=)
   at #=ziYYDgCOI9XvuTjGmbALJ5m_MmaaU.#=z2LHIfiY=(Stream #=zag2acIWiccKS, Document #=zb50g2w9M2HsL, HtmlLoadOptions #=z8XWl92SxULqa, String #=z8_CisyEchoH1)
   at #=ziYYDgCOI9XvuTjGmbALJ5m_MmaaU.#=z2LHIfiY=(Stream #=zag2acIWiccKS, Document #=zb50g2w9M2HsL, HtmlLoadOptions #=z8XWl92SxULqa)
   at Aspose.Pdf.Document.#=z9jbIOJg=(Stream #=zLhuAIlM=, LoadOptions #=zX_mpQM8=)
   at Aspose.Pdf.Document..ctor(Stream input, LoadOptions options)

InheritZoom not work for 1st Bookmark

I tried the example in the repository InheritZoom , but I got an unexpected behavior:

   XYZExplicitDestination dest = new XYZExplicitDestination(0, 0, 0, 1); // It doesn't change the page
   XYZExplicitDestination dest = new XYZExplicitDestination(1, 0, 0, 1); // It goes to page 2
   XYZExplicitDestination dest = new XYZExplicitDestination(2, 0, 0, 1);   // It goes to page 3

There is no way to go to 1st page.

how to use license file

I am attempting to utilize a licensed version, but I am uncertain about how to configure the application to use the license file.

System.Drawing.Common is deprecated on non-Windows platforms

Hello, I work on the .NET Libraries team, and I saw that this library has a lot of usage in the community and depends on System.Drawing.Common for xplat scenarios.

We made the decision to make System.Drawing.Common a windows only library starting .NET6+ due to a lot of reasons after a long discussion. You can see more details here:
https://github.com/dotnet/designs/blob/a15a8c7a324c482c5e38b73e46c2afe56f6bd504/accepted/2021/system-drawing-win-only/system-drawing-win-only.md

Also: dotnet/docs#25257

We wanted to reach out so that you could react to this changes when .NET 6 is released. Also if you have any questions/concerns please do let us know at https://github.com/dotnet/runtime

What is the recommended action to still support winforms/wpf scenarios for example?

You can mark the APIs that need to use System.Drawing.Common to support winforms/wpf as windows only using the SupportedOSPlatform("windows") annotation, and then add new APIs that use another library like ImageSharp or `SkiaSharp.

Does Aspose.Pdf not support Chinese?

Q:Pdf does not support Chinese it? Will it be supported in the future?
operation:html to pdf...
version: aspose.pdf 21.5
platform:net 5.0

public static void ConvertHTMLtoPDFAdvanced_WebPage()
{
    const string url = @"https://mp.weixin.qq.com/s/dWGzQI5mdmItVXcuxVLOQA";
    HtmlLoadOptions options = new HtmlLoadOptions(url) {};
    Document pdfDocument = new Document(GetContentFromUrlAsStream(url), options);
    pdfDocument.Save(AppDomain.CurrentDomain.BaseDirectory + "html_test.PDF");
}

private static Stream GetContentFromUrlAsStream(string url, ICredentials credentials = null)
{
    using (var handler = new HttpClientHandler { Credentials = credentials })
    using (var httpClient = new HttpClient(handler))
    {
        return httpClient.GetStreamAsync(url).GetAwaiter().GetResult();
    }
}

2021-05-20_23-46-33.png

Issue generating PDF using html string

I use the following code to generate a PDF using the ASPOSE.PDF package. My requirements meant that while generating the PDF, I need the output in a memory stream and not saved to disk. So couldn't use the aspose code that takes a save file path as a parameter. Here's what I had:

public Stream GeneratePdfStream(string html)
{
    // Verify our license is loaded before using.
    VerifyLicense();

    // Turn our string into bytes using encoding.
    using var stream = new MemoryStream(Encoding.ASCII.GetBytes(html ?? string.Empty));

    // Create HTML load options
    HtmlLoadOptions htmloptions = new HtmlLoadOptions();
    htmloptions.HtmlMediaType = HtmlMediaType.Print;
    htmloptions.PageInfo.Margin.Bottom = 0;
    htmloptions.PageInfo.Margin.Top = 0;
    htmloptions.PageInfo.Margin.Right = 0;
    htmloptions.PageInfo.Margin.Left = 0;

    // Load HTML file
    Document pdfDocument = new Document(stream, htmloptions);

    // Convert HTML file to PDF
    Stream memoryStream = new MemoryStream();

    // Save output as PDF format
    pdfDocument.Save(memoryStream);
    memoryStream.Seek(0, SeekOrigin.Begin);
    return memoryStream;
}

This means that I can then download the stream for the PDF via a web API or I can convert to Base64, depending on my use case.
Calling this method with this parameter works fine:

var html = "<html><body><h1>This is a test</h1></body></html>";
var pdfStream = GeneratePdfStream(html);

using (FileStream fs = File.Create("somePath.pdf"))
{
      fs.CopyTo(pdfStream);
}

However, when I use a more real-world example, i.e. this:

// Roughly, a 10kb worth of content here.
var html = "<!doctype html> <html lang='en'> <head> <meta charset='utf-8'> <meta charset='utf-8'> <meta http-equiv='X-UA-Compatible' content='IE=edge'> <title>Invoice</title> <style> html { font-family: sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }  body { margin: 0; }  strong { font-weight: 700; }  h1 { font-size: 2em; margin: 0.67em 0; }  sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; top: -0.5em; }  img { border: 0; }  table { border-collapse: collapse; border-spacing: 0; }  td, th { padding: 0; }  html { font-size: 10px; -webkit-tap-highlight-color: #fff; }  body { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.42857143; color: #333; background-color: #fff; }  img { vertical-align: middle; }  h1, h2, h3 { font-family: inherit; font-weight: 500; line-height: 1.1; color: inherit; }  h1, h2, h3 { margin-top: 20px; margin-bottom: 10px; }  h1 { font-size: 36px; }  h2 { font-size: 30px; }  h3 { font-size: 24px; }  p { margin: 0 0 5px; }  .text-right { text-align: right; }  .row { margin-right: -15px; margin-left: -15px; }  .col-xs-2, .col-xs-4, .col-xs-8, .col-xs-10, .col-xs-12 { position: relative; min-height: 1px; padding-right: 15px; padding-left: 15px; float: left; }  .col-xs-12 { width: 100%; }  .col-xs-10 { width: 83.33333333%; }  .col-xs-8 { width: 66.66666667%; }  .col-xs-4 { width: 33.33333333%; }  .col-xs-2 { width: 16.66666667%; }  table { background-color: transparent; }  th { text-align: left; }  .table { width: 100%; max-width: 100%; margin-bottom: 20px; }  .table > thead > tr > th, .table > tbody > tr > th, .table > tfoot > tr > th, .table > thead > tr > td, .table > tbody > tr > td, .table > tfoot > tr > td { padding: 8px; line-height: 1.42857143; vertical-align: top; border-top: 1px solid #ddd; }  .table > thead > tr > th { vertical-align: bottom; border-bottom: 2px solid #ddd; }  .table > caption + thead > tr:first-child > th, .table > colgroup + thead > tr:first-child > th, .table > thead:first-child > tr:first-child > th, .table > caption + thead > tr:first-child > td, .table > colgroup + thead > tr:first-child > td, .table > thead:first-child > tr:first-child > td { border-top: 0; }  .table > tbody + tbody { border-top: 2px solid #ddd; }  .row:before, .row:after { display: table; content: ' '; }  .row:after { clear: both; }  body { width: 100%; height: 100%; margin: 0; padding: 0; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-weight: 400; color: #000; font-size: 8pt; line-height: 1.5; }  * { box-sizing: border-box; -moz-box-sizing: border-box; }  .page { width: 210mm; min-height: 297mm; padding: 10mm 20mm; margin: 10mm auto; position: relative; background: #fff; box-shadow: 0 0 5px #d2d2d2; }  h1 { font-size: 18pt; font-weight: 500; margin: 30px 0 20px 0; }  h2 { font-size: 12pt; font-weight: 700; text-transform: uppercase; }  h3 { font-size: 8pt; font-weight: 700; text-transform: uppercase; margin: 0 0 10px 0; }  .logo { position: absolute; left: 20mm; width: 50mm; height: 20mm; }  .addresses { display: -webkit-box; display: -moz-box; display: -webkit-flex; display: -ms-flexbox; display: flex; }  .addresses .address-col { line-height: 1.5; padding: 0; min-width: 28%; max-width: 35%; display: inline-block; -ms-flex: 1 1 auto; flex: 1 1 auto; }  .addresses .address-divider { border-left: 1px solid #b0b0b0; display: block; padding: 0 4mm; }  .date-info { text-align: right; }  .date-info p { font-size: 9pt; line-height: 1.2; margin: 0 0 0.9rem 0; }  .registration-footer { border-top: 1px solid #b0b0b0; display: block; width: 100%; padding: 15px 15px 0 15px; }  .reason-count { margin: 0 5px; }  .table-invoice { margin-top: 10px; border-bottom: 1px solid #000; }  .table-invoice thead tr th { -webkit-print-color-adjust: exact !important; background-color: #000; color: #fff; border-bottom: 0 none !important; vertical-align: middle !important; padding: 10px 15px; }  .table-invoice thead tr th:nth-child(6) { width: 12%; padding: 0; padding-right: 10px; }  .table-invoice div.incl-vat-text { font-size: 10px; }  .table-invoice tbody tr td { padding: 5px 15px; border-color: #b0b0b0; }  .table-invoice tbody tr:first-of-type td { border-top: 0 none; }  .table-invoice.side-borders { border-bottom: 0 none; }  .table-invoice.side-borders thead tr th { border: 1px solid #ccc; }  .table-invoice.side-borders tbody tr td { border: 1px solid #ccc; }  .table-totals tbody tr td { padding: 0 0 10px 0; border: 0 none; }  .text-watermark { -webkit-print-color-adjust: exact !important; position: absolute; top: 40%; left: 0; width: 210mm; text-align: center; font-size: 110pt; color: #e6e6e6 !important; -ms-transform: rotate(-48deg); -webkit-transform: rotate(-48deg); transform: rotate(-48deg); }  @@media print { html, body { width: 210mm; height: auto; }  .page { margin: 0; border: initial; border-radius: initial; width: initial; min-height: initial; box-shadow: initial; background: initial; page-break-after: always; }  .table-invoice { border-bottom: 1px solid #000; }  .table-invoice thead tr th { -webkit-print-color-adjust: exact !important; background-color: #000 !important; color: #fff !important; }  .text-watermark { -webkit-print-color-adjust: exact !important; } }  .pr-0, .px-0 { padding-right: 0 !important; }  .pl-0, .px-0 { padding-left: 0 !important; }  .text-right { text-align: right !important; }  .m-0 { margin: 0 !important; }  .mb-0, .my-0 { margin-bottom: 0 !important; }  .mb-1, .my-1 { margin-bottom: 0.25rem !important; }  .mb-2, .my-2 { margin-bottom: 0.5rem !important; }  .mt-3, .my-3 { margin-top: 1rem !important; }  .mb-3, .my-3 { margin-bottom: 1rem !important; } </style> </head> <body> <div id='invoice' class='page'>  <img src='https://svgur.com/i/NRB.svg' class='logo' alt='examples' />  <div class='row px-0'> <div class='col-xs-12 text-right text-light'> example's<sup>&reg;</sup> Customer Services<br /> P: 00800 53847 501<br /> https://www.example.com/GB/en_GB/contact<br /> Shop: example.com </div> </div>  <div class='row px-0'> <div class='col-xs-12 text-right'> <h1>Invoice</h1> </div> </div>  <div class='row px-0'> <div class='col-xs-10'> <div class='addresses'> <div class='address-col'> <h3><strong>BILL TO</strong></h3> <p> {{BillingAddress:FirstName}}&nbsp;{{BillingAddress:LastName}}<br /> {{BillingAddress:Address1}}<br /> {{BillingAddress:Address2}}<br /> {{BillingAddress:Address3}}<br /> {{BillingAddress:City}}<br /> {{BillingAddress:PostalCode}}<br /> {{BillingAddress:Country}} </p> <p class='mb-0'><strong>P:</strong> {{BillingAddress:Telephone}}</p> </div>  <div class='address-divider'></div>  <div class='address-col'> <h3><strong>SHIP TO</strong></h3> <p> {{ShippingAddress:FirstName}}&nbsp;{{ShippingAddress:LastName}}<br /> {{ShippingAddress:Address1}}<br /> {{ShippingAddress:Address2}}<br /> {{ShippingAddress:Address3}}<br /> {{ShippingAddress:City}}<br /> {{ShippingAddress:PostalCode}}<br /> {{ShippingAddress:Country}} </p> <p class='mb-0'><strong>P:</strong> {{ShippingAddress:Telephone}}</p> </div>  <div class='address-divider'></div>  <div class='address-col'> <h3><strong>SOLD BY</strong></h3> <p> example Strauss &amp; Co Europe<br /> Airport Building<br /> someplace 19<br /> 1831 Diegem<br /> Belguim </p> </div> </div> </div> <div class='col-xs-2 date-info'> <p> <strong>Order No.</strong><br /> {{ORDERNUMBER}} </p> <p> <strong>Order Date</strong><br /> {{ORDERDATE}} </p> <p> <strong>Invoice No.</strong><br /> {{INVOICENUMBER}} </p> <p> <strong>Issue Date</strong><br /> {{ORDERDATE}} </p> </div> </div>  <div class='row px-0'> <div class='col-xs-10'> <p class='mt-3'><strong>Dear Customer,</strong></p> <p>Thank you for shopping on example.com. </p> <p>If your order comes in multiple shipments, each invoice will show the initial shipping charge but you will only be charged once for your order.</p> <p>If you have any questions relating to your purchase, please visit us at example.com. Please check our Help Centre section for further guidance.</p> <p>In case of returns, please note that you have 28 days to return any item.</p> <p>We look forward to seeing you next time.</p> <p class='mb-0'>example's<sup>&reg;</sup> Customer Service</p> </div> </div>  <div class='row px-0'> <div class='col-xs-12 px-0'> <p class='text-right'><strong>VAT amount and price are in: GBP</strong></p> <table class='table table-invoice'> <thead> <tr> <th>Product Code</th> <th>Description</th> <th>Size</th> <th>Qty</th> <th>VAT%</th> <th class='text-right'> Line Total <div class='incl-vat-text'>(Inc VAT)</div> </th> </tr> </thead> <tbody> <tr> <td>ABC123</td> <td> Umbrella1 </td> <td>100cm x 100cm</td> <td>1</td> <td class='text-right'>19.99</td> <td class='text-right'>60.00</td> </tr> <tr> <td>ZXY987</td> <td> Umbrella2 </td> <td>100cm x 100cm</td> <td>1</td> <td class='text-right'>19.99</td> <td class='text-right'>60.00</td> </tr> </tbody> </table> </div> </div>  <div class='row px-0'> <div class='col-xs-8'> <h3 class='mb-3'>Payment Info</h3> <p class='mb-1'><strong>Customer No.</strong> {{CUSTOMERNUMBER}}</p> <p class='mb-1'><strong>Payment Method.</strong> {{PAYMENTMETHOD}}</p> </div> <div class='col-xs-4'> <table class='table table-totals'> <tbody> <tr> <td><h3 class='m-0'>SUBTOTAL</h3></td> <td class='text-right'>{{CURRENCYSYMBOL}}{{SUBTOTAL}}</td> </tr> <tr> <td><strong>SHIPPING</strong></td> <td class='text-right'>{{CURRENCYSYMBOL}}{{SHIPPINGTOTAL}}</td> </tr> <tr> <td><strong>VAT</strong></td> <td class='text-right'>{{CURRENCYSYMBOL}}{{VAT}}</td> </tr> <tr> <td><h2 class='m-0'>TOTAL</h2></td> <td class='text-right'><h2 class='m-0'>{{CURRENCYSYMBOL}} {{TOTAL}}</h2></td> </tr> </tbody> </table> </div> </div>  <div class='row px-0'> <div class='col-xs-12 px-0'> <div class='registration-footer'> <p class='mb-2'> <strong>Vat Registration Number:</strong> GB 111 111 111 </p> <p class='mb-2'><strong>Company Registration Number:</strong> 0424 656 991</p> <p class='mb-2'><strong>Place Of Registration:</strong> 181 someplace, Canada</p> <p class='mb-2'><strong>Registered office address:</strong>  Someplace 19, 181 Someotherplace</p> </div> </div> </div> </div> </body> </html>";

var pdfStream = GeneratePdfStream(html);

using (FileStream fs = File.Create("somePath.pdf"))
{
      fs.CopyTo(pdfStream);
}

This fails at the following line in the GeneratePdf method:
Document pdfDocument = new Document(stream, htmloptions);

It never steps beyond this line. I can see this output to debug console in Visual Studio:

Exception thrown: 'System.MissingMethodException' in System.Private.CoreLib.dll

'testhost.exe' (CoreCLR: clrhost): Loaded 'zx_58deb2a6301a4e96b0b71407b2d74f51'. Module was built without symbols.
Exception thrown: '#=zT$tWUPWC0$36rF0x5R0MIrd44UNN_lb$xzK12V4=' in Aspose.Pdf.dll
Exception thrown: '#=zT$tWUPWC0$36rF0x5R0MIrd44UNN_lb$xzK12V4=' in Aspose.Pdf.dll
Exception thrown: '#=zT$tWUPWC0$36rF0x5R0MIrd44UNN_lb$xzK12V4=' in Aspose.Pdf.dll
Exception thrown: '#=zT$tWUPWC0$36rF0x5R0MIrd44UNN_lb$xzK12V4=' in Aspose.Pdf.dll
Exception thrown: 'System.InvalidOperationException' in Aspose.Pdf.dll

I only reference the Aspose.Pdf package, no others. What would be wrong with the approach above? I also tried the approach recommended here: https://docs.aspose.com/display/htmlnet/HTML+to+PDF+Conversion and also get the same issue with the html string above.

Thanks

How to run the demo sample?

I compiled the demo sample (https://github.com/aspose-pdf/Aspose.PDF-for-.NET/tree/master/Demos) but I cannot run it as it has no default page. According to the document as below, there should have a Default page. I also tried to create a web form based on the mater page file "site.Master" but it shows blank. Would anyone know how to run this sample?

How to run

  1. Clone the repository
  2. Open the solution file in the latest version of Microsoft Visual Studio.
  3. Set Default as start page
  4. Build the solution

PDF Created In Acrobat omits lines

Creating a PDF via Acrobat does not persist drawn lines in a pdf that is created from a Word Doc. It used to work. This does not happen when creating a PDF via Word or other applications, but only with Acrobat.

nuget

can use nuget ,local not found

exception on Ubuntu dotnet6.0

Environment: Ubuntu 22.04, dotnet6.0.100
sdk : Bin/net6.0 Aspose.PDF_22_6.zip (dll only)
code:

using System;

using System.IO;
using Aspose.Pdf;
using Aspose.Pdf.Text;

namespace pdf_toolbox
{
    public class NumberPdf{
        public void doNumber(){
            Console.WriteLine("numberPDF....");
            Document doc = new Document();
            Page page = doc.Pages.Add();
            page.Paragraphs.Add(new Aspose.Pdf.Text.TextFragment("Hello World!"));
            doc.Save("HelloWorld_out.pdf");
        }
    }
}

log exception:

numberPDF....
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'key')
   at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at #=ztrFjUrbJYJ47NcR$8LZPthQIUnYfExa7Gg==.#=zJGcmwbM=(#=z8S5r434= #=z844B2I8=)
   at #=z2ZQc$Jcr34z9F64PqOoAxo6zJGdn_ZZShQ==.#=zYasEy4MKvAnG`2.#=zVigH4Ju$VQvV(#=z8S5r434= #=z844B2I8=, #=zmDMNKIw=& #=ztxptzkQ=)
   at #=zQ_oajpj9GYnwC_x_$CeW5sq5gwYzvZnJTeNLm28=.#=z1VnSO5vegSOD(#=zD4i4y_M$HiiP_8I17jzHejk_l_WY #=zyphWEqwLFT3f)
   at #=zFLKHFi4q9yQT1s7qN9F3Pv5T0nRo0qWzQmpbNnoq3YDi.#=zZyoz9Osy_H4G()
   at #=zFLKHFi4q9yQT1s7qN9F3Pv5T0nRo0qWzQmpbNnoq3YDi.#=zMO8ucBo=()
   at #=zQJkE9Lf6vNZzWxdK0PxKoHTE9hWkASZ5zNdndNZOH$KI.#=zDsDANj0=(#=zIrdqJtR4jlHtd_Q9LhynyGAYkowV #=zQ$qH$4U=, #=zLS0bXYESTwt6s9O9ge8mOCQdQu2XgiesZQ== #=zk6jw8Bs=, #=zk_baTkeGsSyYK2fUlwbWQSTWwiuje5rVhDZznXUVXMgE #=ziSVaJls=)
   at Aspose.Pdf.Page.CalculateContentBBox()
   at Aspose.Pdf.Page.#=z1bMZ4IQ=(Page #=zk6jw8Bs=)
   at Aspose.Pdf.Page.#=zSmp$qf7iRTeUfaT1ow==()
   at Aspose.Pdf.Document.ProcessParagraphs()
   at Aspose.Pdf.Document.#=zG7VhpvNMzChd(Stream #=zB8p3Dxo=, SaveOptions #=zsRZvAOZNkW4o)
   at Aspose.Pdf.Document.#=zFx2Xbgl0fHER(String #=zu4ufdYNMrcDG)
   at Aspose.Pdf.Document.Save(String outputFileName)

It doesn't support net6.0 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.