Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo
Free Spire.PDF for .NET is a Community Edition of the Spire.PDF for .NET, which is a totally free PDF API for commercial and personal use.
As a standalone .NET library, Free Spire.PDF for .NET enables developers to create, write, edit, convert, print, handle and read PDF files on any .NET( C#, VB.NET, ASP.NET, .NET Core) applications.
//Create a PDF document and load sample PDF.
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("test.pdf");
//Use SaveToFile method and set conversion target parameter as FileFormat.DOC.
doc.SaveToFile("PDFtoDoc.doc", FileFormat.DOC);
//Create a PDF document and load sample PDF.
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("sample.pdf");
Image bmp = doc.SaveAsImage(0);
Image emf = doc.SaveAsImage(0, Spire.Pdf.Graphics.PdfImageType.Metafile);
Image zoomImg = new Bitmap((int)(emf.Size.Width * 2), (int)(emf.Size.Height * 2));
using (Graphics g = Graphics.FromImage(zoomImg))
{
g.ScaleTransform(2.0f, 2.0f);
g.DrawImage(emf, new Rectangle(new Point(0, 0), emf.Size), new Rectangle(new Point(0, 0), emf.Size), GraphicsUnit.Pixel);
}
//Save as BMP
bmp.Save("convertToBmp.bmp", ImageFormat.Bmp);
System.Diagnostics.Process.Start("convertToBmp.bmp");
//Save as EMF
emf.Save("convertToEmf.png", ImageFormat.Png);
System.Diagnostics.Process.Start("convertToEmf.png");
//Save as ZoomImg
zoomImg.Save("convertToZoom.png", ImageFormat.Png);
System.Diagnostics.Process.Start("convertToZoom.png");
//Create a pdf document.
PdfDocument doc = new PdfDocument();
PdfPageSettings setting = new PdfPageSettings();
setting.Size = new SizeF(1000,1000);
setting.Margins = new Spire.Pdf.Graphics.PdfMargins(20);
PdfHtmlLayoutFormat htmlLayoutFormat = new PdfHtmlLayoutFormat();
htmlLayoutFormat.IsWaiting = true;
String url = "https://www.wikipedia.org/";
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(url, false, false, false, setting,htmlLayoutFormat); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save pdf file.
doc.SaveToFile("output-wiki.pdf");
Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo