PDF Office Component - Hello World

Pdf

Creating a PDF document is straightforward with PDF Office Component - Hello World

With just a few lines of code, your application is now ready to create a brand new PDF Document

What is PDF?

  • PDF (short for Portable Document Format) is a reasonably standard text file format of Adobe Systems. Similar to the Word (.doc) format, PDF supports raw text (text) along with fonts, graphic images, sounds, and many other effects. However, displaying PDF documents does not depend on the working environment of the user (machine configuration, software, and operating system).

Why PDF?

  • As mentioned above, displaying PDF documents does not depend on the working environment of the user, so this is considered the most significant advantage of PDF. Unlike Word documents, a PDF document, in most cases, will be displayed the same in different work environments. Because of this advantage, PDF format has become famous for the publication of books, newspapers, or other documents via the Internet.
  • PDF is the most popular file format today because this format has very high security. After all, users can not edit the original content of the document and allow display without font error. To create PDF files, edit PDF; usually, you have to use Foxit Reader software.
  • To read the PDF file on your computer, you must have software that supports this format. Popular software today is Adobe Reader or Foxit Reader.
  • Surely, PDF files have many advantages, and here are some of the most common benefits that you refer to.
  • As a technology software, the first requirement is safety and security, we can say that the PDF file has high security and a variety of options for users to choose.
  • The range of support on most devices from computers to mobile devices.
  • The PDF file also features regular documents; the PDF format can also display completely the same in all different working environments.
  • And notably, the file size is usually quite small.

When PDF?

  • In the 1990s, when information technology was not developed as it is today, there were many inadequacies in the issue of image data transmission, content, documents with large file images that could not be transmitted. Also, computers and devices were not as modern as they are today, they could handle only a small part, so at that time, an invention needed to solve the problems that people. As a result, software developers have started using links to other resources on the computer. To reduce the amount of content, you need to transfer or save to your computer.
  • And that is the reason for the advent of PDF.
  • However, the popularity of the PDF format at the beginning was relatively slow. Early versions of PDF did not support external hyperlinks, reducing its usefulness on the web. The increased file size compared to plain text also means that the time it takes to download a PDF document will be longer, which is also a problem with slow modems of the time.
  • Adobe soon offered the Acrobat Reader (now Adobe Reader) for free and continues to support the prototype PDF format. Eventually, PDF became the standard format for printable documents on the web.
  • The PDF format has been changed many times and is currently under development.

How to create a PDF Document?

  • First, you need to understand that, PDF has never been, and will never be considered similar to the basic editing formats: Word, Excel, Docx, etc. which means you cannot directly create a document like this. The most common way is still editing the text on another platform and then converting it to PDF format. This method is similar to composing a handwritten document and then taking a picture of it. Here, the written record is the secondary format that you will need for conversion, and the photo you have just made is our PDF document.
  • PDF is the most popular file format today because this format has very high security. After all, users can not edit the original content of the document and allow display without font error. To create PDF files, edit PDF, you usually have to use Foxit Reader software, Adobe Reader, or something just like that. However, there are ways for you to create a PDF without using that specialized software. So, without Foxit Reader, you can still create PDF files with high security.
  • Foxit Reader PDF creation software is known to have many unique features, such as cutting PDF files when your document is too long. The way you cut PDF files in Foxit Reader helps you choose the number of pages you want to cut, split up the PDF files for easy use.

Problems

  • Creating a PDF file is extremely simple, as there is a lot of software that can help you create a PDF file as quickly as Nitro Pro or doPDF .... even you can create a PDF file from Word document 2013. But how would it turn out if you were someone who wanted to develop PDF- related applications? And it will be even more difficult when you want to integrate the ability to create PDF documents right on your app.
  • It will be a ton of work if you decide to learn from the beginning on how to integrate libraries or learn detailed knowledge to implement this problem. What a nightmare.
  • Why not allow yourself to rest and enjoy the fantastic speed of PDF Office Component - A library full of features that will enable you to complete all the work related to PDF documents? An elementary library, convenient, easy to use, and supports many different programming platforms.

Advanced Features

  • It would be flawed if we did not give you the first overview of what PDF Office Component can offer:
  • Create a new document with PDF Office Component: The PdfDocument class allows you to add the ability to create a blank PDF document into your application.
  • With the newly created document, you can completely create a new page with the Pages.Add() method.
  • You can proceed with changing the format, size, and shape of the writing style with classes such as PdfSolidBrush and PdfStandardFont
  • Start drafting your first text documents right now with Graphics.DrawString()
  • Finally, the PdfDocument class also supportSave() and Close() methods.

Example

This example demonstrates how to write a simple text to a PDF document.

C# Version:

// Create a new instance of PdfDocument class.
    PdfDocument doc = new PdfDocument();

    PdfPage page = doc.Pages.Add();

    // Create a solid brush
    PdfBrush brush = new PdfSolidBrush(Color.Black);

    const float fontSize = 24.0f;

    // Set the font
    PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, fontSize);

    // Draw the text
    page.Graphics.DrawString("Hello World!", font, brush, new PointF(30, 30));

    // Save and close the document.
    var outputPath = Path.Combine(OutputDir, this.GetType().Name + "_" + Guid.NewGuid().ToString() + ".pdf");
    doc.Save(outputPath);
    doc.Close(true);

    return outputPath;

VB Version:

    ' Create a new instance of PdfDocument class.
    Dim doc As New PdfDocument()

    Dim page As PdfPage = doc.Pages.Add()

    ' Create a solid brush
    Dim brush As PdfBrush = New PdfSolidBrush(Color.Black)

    Const fontSize As Single = 24.0F

    ' Set the font
    Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, fontSize)

    ' Draw the text
    page.Graphics.DrawString("Hello World!", font, brush, New PointF(30, 30))

    ' Save and close the document.
    Dim outputPath = Path.Combine(OutputDir, Me.GetType().Name & "_" & Guid.NewGuid().ToString() & ".pdf")
    doc.Save(outputPath)
    doc.Close(True)

    Return outputPath

Please note that in the above example, we used the classes installed in the OfficeComponent.Pdf and OfficeComponent.Pdf.Graphics library.

C# Version:

    using OfficeComponent.Pdf;
    using OfficeComponent.Pdf.Graphics;

VB Version:

    Imports OfficeComponent.Pdf
    Imports OfficeComponent.Pdf.Graphics

The full source code of this example is available in our PDF package.

A live demo for Hello World is also available on our site. If you also need PDF functionality, check out our PDF online demos.

45-Day Money Back Guarantee

We will refund your full money in 45 days
if you are not satisfied with our products

Buy Now
You have successfully subcribed to our mailing list.
Dont miss out Get update on new articles and other opportunities Subscribe