• 카테고리
    • 전체 글

    • 카테고리1
    • 카테고리2
    • 카테고리3
    • 카테고리4
  • 태그
  • 방명록

PDF Writer for C#

카테고리 없음 2021. 1. 13. 19:29

매우 매력적인 프로젝트가 있었다.

https://www.codeproject.com/Articles/570682/PDF-File-Writer-Csharp-Class-Library-Version-1-22

PDF File Writer C# Class Library (Version 1.22.0)

요약 내용은 아래와 같다.

The PDF File Writer C# class library PdfFileWriter allows you to create PDF files directly from your .net application. The library shields you from the details of the PDF file structure. To use the library, you need to add a reference to the attached PdfFileWriter.dll class library file, add a using PdfFileWriter statement in every source file that uses the library and include the PdfFileWriter.dll with your distribution. For more details go to 4. Installation. Alternatively, you can include the source code of the library with your application and avoid the need to distribute a separate data link library file. The minimum development requirement is .NET Framework 4.6.2 (Compiled with Visual Studio 2017).

Version 1.22.0: Sticky Notes or Text Annotations

The PDF reference document defines Sticky Notes or Text Annotation in Section 8.4 page 621.  "A text annotation represents a “sticky note” attached to a point in the PDF document. When closed, the annotation appears as an icon; when open, it displays a pop-up window containing the text of the note in a font and size chosen by the viewer application. Text annotations do not scale and rotate with the page; they behave as if the NoZoom and NoRotate annotation flags (see Table 8.16 on page 608) were always set. Table 8.23 shows the annotation dictionary entries specific to this type of annotation." See Section 2.24 Sticky Notes or Text Annotation.

The PDF File Writer C# class library supports the following PDF document's features:

  • Graphics: drawing lines, rectangles, polygons, Bezier curves, foreground and background color, patterns and shading. Section 2.1 Coordinate System.
  • Image: drawing raster (Bitmap) images and vector (Metafile) images. Section 2.4. Image Support.
  • Text: drawing text lines and text in columns. Section 2.3 Language Support.
  • Barcode: support for Barcode 128, Barcode 39, Barcode interleaved 2 of 5, Barcode EAN13 and Barcode UPC-A. Section 2.5 Barcode Support.
  • QR Code: support for two dimensions barcode. Section 2.8 QR Code Support.
  • Encryption: support for AES-128 encryption. Section 2.6 Encryption Support.
  • Web Link: Web link interactive support. Section 2.7 Web Link Support.
  • Bookmark: Support for document outline. Section 2.9 Bookmark Support.
  • Named Destinations: Support for making Acrobat open the PDF document at a specific page. Section 2.22 Document Links and Named Destinations.
  • Charts: Support for Microsoft Charting. Section 2.10 Charting Support.
  • Print to PDF: Create a PDF document from PrintDocument process. Section 2.11 PrintDocument Support.
  • Display data tables. Section 2.12 Data Table Support
  • Play video files. Section 2.13 Play Video Files
  • Play sound files. Section 2.14 Play Sound Files
  • Attach data files. Section 2.15 Attach Data Files
  • Reorder pages. Section 2.16 Reorder Pages
  • PDF document output to a file or to a stream. Section 2.17 PDF Document Output.
  • PDF document information dictionary. The PDF reader displays this information in the Description tab of the document properties. The information includes: Title, Author, Subject, Keywords, Created date and time, Modified date and time, the Application that produced the file, the PDF Producer. Section 2.18 Document Information Dictionary.
  • Memory control: Write contents information of completed pages to output file and free unused memory with garbage collector. Section 2.19. Memory Control.
  • Draw artwork defined by System.Windows.Media.PathGeometry class. Input argument can be text string or PathGeometry class. Section 2.20 Windows Presentation Foundation WPF
  • Transparency or opaqueness is now available for painting shapes, lines, text and images. Your application can set the alpha component of color for all graphics and text. Section 2.21 Transparency, Opacity, Alpha Color Component and Blending
  • Blend. The new library supports the PDF color blending scheme. Blending defines how the color of a new item painted over a previous item is handled. Section 2.21 Transparency, Opacity, Alpha Color Component and Blending
  • Document Links and Named Destination. Section 2.22 Document Links and Named Destination.
  • PDF417 barcode. Section 2.23 PDF417 Barcode.

Creating a PDF is a six steps process.

  • Step 1: Create one document object PdfDocument.
  • Step 2: Create resource objects such as fonts or images (i.e. PdfFont or PdfImage).
  • Step 3: Create page object PdfPage.
  • Step 4: Create contents object PdfContents.
  • Step 5: Add text and graphics to the contents object (using PdfContents methods).
  • Repeat steps 3, 4 and 5 for additional pages
  • Step 6: Create your PDF document file by calling CreateFile method of PdfDocument.

Step 5 is where most of your programming effort will be spent. Adding contents is achieved by calling the methods of PdfContents class to render graphics and text. The contents class has a rich set (about 100) of methods for adding text and graphics to your document.

PdfDocument implements the IDisposable interface to release unmanaged resources. The CreateFile method calls Document.Dispose() after the PDF file is created. However, to ensure the release of resources you should wrap the PdfDocument creation and the final CreateFile with either a using statement or a try/catch block./p>

The demo program attached to this article is the test program developed to debug the library. The TestPdfFileWriter has six buttons on the main screen. Five buttons to produce examples of PDF files and one button to display all fonts available on your computer. The first button “Article Example” creates the PDF file displayed at the top of this article. Section 3. Development Guide by Example.

As stated before, the PdfFileWriter C# class library shields you from the complexities of the PDF file structure. However, good understanding of PDF file is always an advantage. Adobe PDF file specification document available from Adobe website: “PDF Reference, Sixth Edition, Adobe Portable Document Format Version 1.7 November 2006”. It is an intimidating 1310 pages document. I would strongly recommend reading Chapter 4 Graphics and sections 5.2 and 5.3 of the Text chapter 5.

If you want to analyze the PDF files created by this project, or if you want to understand PDF file structure in general, you can use the demo program attached to my previous article "PDF File Analyzer With C# Parsing Classes". This article provides a concise overview of the PDF specifications.


일단 백업 차원에서 해당 파일도 여기에 등록해보도록 한다.
(링크가 사라져서 곤란한적이 여러번;;;)

PdfFileWriter_demo.zip

PdfFileWriter_dll.zip

PdfFileWriter_example.zip

PdfFileWriter_src.zip

2019. 2. 21. 오후 5:31

728x90
저작자표시 (새창열림)
블로그 이미지

하인도1

[하인드/하인도/인도짱 의 홈페이지] 저만의 공간입니다. 다양한 소재들을 나열하는 아주 단순 무식한 홈페이지 입니다. 다양한 문서 자료도 있겠지만, 저의 푸념들도 있답니다.

250x250

블로그 내에 소스 코드 삽입 이사온 기념 스킨도... RSS 전문 기능 비활성화 관련. 스킨 바꾸어 보았습니다. 서버 파일 정리 좀 했습니다.

«   2025/06   »
일 월 화 수 목 금 토
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30

친구 twi2me Visual Studio 지름신 Tutorial 오류 Google Apps Engine 수 Azure WSS 협업 매뉴얼 moss MOSS 2007 비스킷 2010 좀 블로그 개발환경 Buscuit 것 me2sms windows java e-book 인터파크 me2dayzm 불만 SharePoint me2photo

  • Total :
  • Today :
  • Yesterday :

Copyright © 2015-2025 Socialdev. All Rights Reserved.

Copyright © 2015-2025 Socialdev. All Rights Reserved.

티스토리툴바