Finale PDK Framework  0.54
ff_pdfwriter.h
1 /*
2  * File: fc_pdfwriter.h
3  * Author: Jari
4  *
5  * Created on den 3 mars 2014, 13:09
6  */
7 
8 #ifndef FC_PDFWRITER_H
9 #define FC_PDFWRITER_H
10 
11 #ifdef PDK_FRAMEWORK_PDFWRITER
12 
13 #include "ff_base.h"
14 
21 class FCPDFPage : public __FCBase
22 {
23  void* _page; /* HPDF_Page type */
24  void* _doc; /* HPDF_Doc type, for reference only */
25 
26  float _leftmargin;
27  float _rightmargin;
28  float _topmargin;
29  float _bottommargin;
30 
31  float _lasttextposx;
32  float _lasttextposy;
33  public:
38  FCPDFPage(void* pPageStruct, void* pDocStruct);
39 
44  void SetWidth(float width);
45 
50  float GetWidth() const;
51 
56  void SetHeight(float height);
57 
62  float GetHeight() const;
63 
68  void SetLineWidth(float linewidth);
69 
74  float GetLineWidth() const;
75 
82  float GetGrayStroke() const;
83 
90  void SetGrayStroke(float value);
91 
98  void SetGrayFill(float value);
99 
106  float GetGrayFill() const;
107 
118  bool SetFontAndSize(const char* pszFontName, float size);
119 
127  void SetMargins(float leftmargin, float rightmargin, float topmargin, float bottommargin);
128 
133  void DrawString(FCString* pString, int x, int y);
134 
139  void DrawLine(float x1, float y1, float x2, float y2);
140 
145  void DrawBlackLine(float x1, float y1, float x2, float y2, float linewidth);
146 
151  void DrawBlackBorderRect(float x1, float y1, float x2, float y2, float linewidth);
152 
166  void DrawTextRect(FCString* pString, float left, float top, float right, float bottom);
167 
172  float GetLastTextPosX() const;
173 
178  float GetLastTextPosY() const;
179 
184  float GetInnerLeft() const;
185 
190  float GetInnerTop() const;
191 
196  float GetInnerRight() const;
197 
202  float GetInnerBottom() const;
203 };
204 
205 
216 {
217  void* _doc; /* HPDF_Doc type */
218 
219  FCString _filename;
220  public:
221 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
222  static int _lasterrorcode;
223  static int _lasterrordetail;
224  static float _defaultpagewidth;
225  static float _defaultpageheight;
226 #endif
227 
236  FCPDFWriter(FCString* pFileName);
237 
242  bool Save();
243 
249  bool Close();
250 
255  bool IsOpened() { return (_doc != NULL); }
256 
258  virtual ~FCPDFWriter();
259 
270  FCPDFPage* AddPage();
271 
276  void GetFileName(FCString* pString);
277 
287  static int GetLastError();
288 
298  static int GetLastErrorDetail();
299 
308  static void SetDefaultPageSize(float width, float height);
309 };
310 
311 #endif /* PDK_FRAMEWORK_PDFWRITER */
312 
313 
314 #endif /* FC_PDFWRITER_H */
315 
static int GetLastError()
Static method that returns the last error code for a PDF call. This is a standard LibHaru error code...
Definition: finaleframework.cpp:32888
float GetLastTextPosX() const
Returns the horizontal end position after a DrawTextRect call.
Definition: finaleframework.cpp:32795
void GetFileName(FCString *pString)
Copies the file name path to the FCString object.
Definition: finaleframework.cpp:32881
FCPDFWriter(FCString *pFileName)
The constructor.
Definition: finaleframework.cpp:32840
void DrawString(FCString *pString, int x, int y)
Draws a FCString object at a specific position, using the current font, size and color.
Definition: finaleframework.cpp:32742
float GetHeight() const
Returns the height of the page.
Definition: finaleframework.cpp:32701
float GetInnerBottom() const
Returns the horizontal coordinate at the bottom margin.
Definition: finaleframework.cpp:32820
bool IsOpened()
Returns true if the PDF file is accessible to data creation and saves.
Definition: ff_pdfwriter.h:255
Class to create a PDF and write it to disk. This is also a collection of FCPDFPage objects...
Definition: ff_pdfwriter.h:215
FCPDFPage(void *pPageStruct, void *pDocStruct)
The constructor.
Definition: finaleframework.cpp:32674
A representation of a page in a created PDF file.
Definition: ff_pdfwriter.h:21
float GetGrayFill() const
Returns the current gray fill value for the page.
Definition: finaleframework.cpp:32726
bool SetFontAndSize(const char *pszFontName, float size)
Sets the stock font and size for subsequent text operations on the page.
Definition: finaleframework.cpp:32736
void SetGrayFill(float value)
Sets the gray fill value for the subsequent drawing operations on the page.
Definition: finaleframework.cpp:32721
void DrawBlackLine(float x1, float y1, float x2, float y2, float linewidth)
Draws a black solid line with a specified line width.
Definition: finaleframework.cpp:32758
bool Save()
Definition: finaleframework.cpp:32855
float GetGrayStroke() const
Returns the current gray stroke value for the page.
Definition: finaleframework.cpp:32716
Base class for the Finale Framework classes.
Definition: ff_base.h:47
static void SetDefaultPageSize(float width, float height)
Static method that sets the default page size that will be used for all subsequent calls to the AddPa...
Definition: finaleframework.cpp:32900
float GetLineWidth() const
Returns the current line width for the page (in points).
Definition: finaleframework.cpp:32711
void SetMargins(float leftmargin, float rightmargin, float topmargin, float bottommargin)
Sets all the margins for the page.
Definition: finaleframework.cpp:32777
void SetHeight(float height)
Sets the height for the page.
Definition: finaleframework.cpp:32696
void SetLineWidth(float linewidth)
Sets the line width (in points) for all subsequent drawing operations.
Definition: finaleframework.cpp:32706
static int GetLastErrorDetail()
Static method that returns the last error detail for a PDF error. This is a standard LibHaru error de...
Definition: finaleframework.cpp:32894
float GetWidth() const
Returns the width of the page (in points).
Definition: finaleframework.cpp:32691
float GetInnerRight() const
Returns the horizontal coordinate at the right margin.
Definition: finaleframework.cpp:32815
virtual ~FCPDFWriter()
The destructor.
Definition: finaleframework.cpp:32850
bool Close()
Closes the PDF file. After a call to this method, the object can no longer be used to create or save ...
Definition: finaleframework.cpp:32861
FCPDFPage * AddPage()
Appends a page to the PDF.
Definition: finaleframework.cpp:32869
Class that provides storage for text. This is to achieve platform-transparent text handling...
Definition: ff_base.h:1473
float GetLastTextPosY() const
Returns the vertical end position after a DrawTextRect call.
Definition: finaleframework.cpp:32800
void DrawBlackBorderRect(float x1, float y1, float x2, float y2, float linewidth)
Draws a black solid rectangle border with a specified line width.
Definition: finaleframework.cpp:32769
void DrawLine(float x1, float y1, float x2, float y2)
Draws a line using the current stroke color value.
Definition: finaleframework.cpp:32751
void DrawTextRect(FCString *pString, float left, float top, float right, float bottom)
Draws text within a rectangle. Word-wrapping if needed.
Definition: finaleframework.cpp:32785
void SetGrayStroke(float value)
Sets the gray stroke value for the subsequent drawing operations on the page.
Definition: finaleframework.cpp:32731
void SetWidth(float width)
Sets the width for the page (in points).
Definition: finaleframework.cpp:32686
float GetInnerLeft() const
Returns the horizontal coordinate at the left margin.
Definition: finaleframework.cpp:32805
Base class for all collection classes. A collection is a storage that can store multiple objects of s...
Definition: ff_basecollection.h:24
float GetInnerTop() const
Returns the horizontal coordinate at the top margin.
Definition: finaleframework.cpp:32810