Skip to content

Commit

Permalink
Merge pull request #36 from klippa-app/feature/implement-fpdfview
Browse files Browse the repository at this point in the history
Implement fpdfview: named destinations, bitmap handling; support render flags in render helpers
  • Loading branch information
jerbob92 authored Feb 6, 2022
2 parents 86afa65 + 0e86c57 commit f5e98d8
Show file tree
Hide file tree
Showing 19 changed files with 4,010 additions and 48 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@

* Option between single-threaded and multi-threaded (through subprocesses), while keeping the same interface
* This library will handle all complicated cgo gymnastics for you
* The goal is to implement all PDFium public API methods (including experimental), current progress: 30%
* The goal is to implement all PDFium public API methods (including experimental), current progress: 40%
* Current PDFium methods exposed, no cgo required
* PDFium instance configuration (sandbox policy, fonts)
* Document loading (from bytes, path or io.ReadSeeker)
* Document info (metadata, page count, render mode, PDF version, permissions, security handler revision)
* Page info (size, transparency)
* Rendering (through bitmap)
* Bitmap handling
* Named destinations
* Text handling (extract, search, text size/color/font information)
* Creation (create new documents and pages)
* Editing (rotating, import pages from another document, copy view preferences from another document, flattening)
Expand All @@ -31,15 +33,18 @@
* JavaScript actions
* Thumbnails
* Attachments
* XFA packet handling
* ViewerRef (print settings)
* Methods to be implemented:
* Form filling
* Bitmap handling
* Named destinations
* Transformations (page boxes, clip paths)
* Annotations
* Document loading through data availability
* Progressive rendering
* Struct trees
* Methods that won't be implemented for now:
* Win32-only methods
* fpdf_sysfontinfo.h (probably too complicated)
* Useful helpers to make your life easier:
* Get all document metadata
* Get all document bookmarks
Expand Down
38 changes: 38 additions & 0 deletions enums/enums.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,41 @@ const (
FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP FPDF_TEXT_RENDERMODE = 6
FPDF_TEXTRENDERMODE_CLIP FPDF_TEXT_RENDERMODE = 7
)

type FPDF_BITMAP_FORMAT int

const (
FPDF_BITMAP_FORMAT_UNKNOWN FPDF_BITMAP_FORMAT = 0 // Unknown or unsupported format.
FPDF_BITMAP_FORMAT_GRAY FPDF_BITMAP_FORMAT = 1 // Gray scale bitmap, one byte per pixel.
FPDF_BITMAP_FORMAT_BGR FPDF_BITMAP_FORMAT = 2 // 3 bytes per pixel, byte order: blue, green, red.
FPDF_BITMAP_FORMAT_BGRX FPDF_BITMAP_FORMAT = 3 // 4 bytes per pixel, byte order: blue, green, red, unused.
FPDF_BITMAP_FORMAT_BGRA FPDF_BITMAP_FORMAT = 4 // 4 bytes per pixel, byte order: blue, green, red, alpha.
)

type FPDF_DUPLEXTYPE int

const (
FPDF_DUPLEXTYPE_UNDEFINED FPDF_DUPLEXTYPE = 0
FPDF_DUPLEXTYPE_SIMPLEX FPDF_DUPLEXTYPE = 1
FPDF_DUPLEXTYPE_DUPLEX_FLIP_SHORT_EDGE FPDF_DUPLEXTYPE = 2
FPDF_DUPLEXTYPE_DUPLEX_FLIP_LONG_EDGE FPDF_DUPLEXTYPE = 3
)

type FPDF_RENDER_FLAG int

const (
FPDF_RENDER_FLAG_ANNOT FPDF_RENDER_FLAG = 0x01 // Set if annotations are to be rendered.
FPDF_RENDER_FLAG_LCD_TEXT FPDF_RENDER_FLAG = 0x02 // Set if using text rendering optimized for LCD display. This flag will only take effect if anti-aliasing is enabled for text.
FPDF_RENDER_FLAG_NO_NATIVETEXT FPDF_RENDER_FLAG = 0x04 // Don't use the native text output available on some platforms.
FPDF_RENDER_FLAG_GRAYSCALE FPDF_RENDER_FLAG = 0x08 // Grayscale output.
FPDF_RENDER_FLAG_DEBUG_INFO FPDF_RENDER_FLAG = 0x80 // Obsolete, has no effect, retained for compatibility.
FPDF_RENDER_FLAG_NO_CATCH FPDF_RENDER_FLAG = 0x100 // Obsolete, has no effect, retained for compatibility.
FPDF_RENDER_FLAG_RENDER_LIMITEDIMAGECACHE FPDF_RENDER_FLAG = 0x200 // Limit image cache size.
FPDF_RENDER_FLAG_RENDER_FORCEHALFTONE FPDF_RENDER_FLAG = 0x400 // Always use halftone for image stretching.
FPDF_RENDER_FLAG_PRINTING FPDF_RENDER_FLAG = 0x800 // Render for printing.
FPDF_RENDER_FLAG_RENDER_NO_SMOOTHTEXT FPDF_RENDER_FLAG = 0x1000 // Set to disable anti-aliasing on text. This flag will also disable LCD optimization for text rendering.
FPDF_RENDER_FLAG_RENDER_NO_SMOOTHIMAGE FPDF_RENDER_FLAG = 0x2000 // Set to disable anti-aliasing on images.
FPDF_RENDER_FLAG_RENDER_NO_SMOOTHPATH FPDF_RENDER_FLAG = 0x4000 // Set to disable anti-aliasing on paths.
FPDF_RENDER_FLAG_REVERSE_BYTE_ORDER FPDF_RENDER_FLAG = 0x10 // Set whether to render in a reverse Byte order, this flag is only used when rendering to a bitmap.
FPDF_RENDER_FLAG_CONVERT_FILL_TO_STROKE FPDF_RENDER_FLAG = 0x20 // Set whether fill paths need to be stroked. This flag is only used when FPDF_COLORSCHEME is passed in, since with a single fill color for paths the boundaries of adjacent fill paths are less visible.
)
Loading

0 comments on commit f5e98d8

Please sign in to comment.