Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pdf.mod/common.bmx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ Extern
Function HPDF_GetInfoAttr:Byte Ptr(handle:Byte Ptr, infoType:EPDFInfoType)
Function HPDF_SetInfoDateAttr:ULongInt(handle:Byte Ptr, infoType:EPDFInfoType, date:SPDFDate)
Function HPDF_GetEncoder:Byte Ptr(handler:Byte Ptr, encodingName:Byte Ptr)
Function HPDF_GetCurrentEncoder:Byte ptr(handler:Byte Ptr, encodingName:Byte Ptr)
Function HPDF_GetCurrentEncoder:Byte Ptr(handler:Byte Ptr, encodingName:Byte Ptr)
Function HPDF_SetCurrentEncoder:ULongInt(handler:Byte Ptr, encodingName:Byte Ptr)
Function HPDF_LoadRawImageFromMem:Byte Ptr(handler:Byte Ptr, buf:Byte Ptr, width:UInt, height:UInt, colorSpace:EPDFColorSpace, bitsPerComponent:UInt)
Function HPDF_UseUTFEncodings:ULongInt(handler:Byte Ptr)
Function HPDF_LoadTTFontFromMemory:Byte Ptr(handler:Byte Ptr, buffer:Byte Ptr, size:UInt, embedding:Byte)

Function HPDF_Page_BeginText:ULongInt(handle:Byte Ptr)
Function HPDF_Page_EndText:ULongInt(handle:Byte Ptr)
Expand Down
Binary file added pdf.mod/examples/FallingSky.ttf
Binary file not shown.
22 changes: 22 additions & 0 deletions pdf.mod/examples/load_font_example.bmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Framework Text.PDF

Local pdf:TPDFDoc = New TPDFDoc()

Local font:TPDFFont = pdf.GetFont(pdf.LoadTTFontFromFile("FallingSky.ttf"))

Local page:TPDFPage = pdf.AddPage()
page.SetWidth(200)
page.SetHeight(200)
page.SetFontAndSize(font, 24)

Local text:String = "Testing"

Local tw:Float = page.TextWidth(text)

page.BeginText()
page.TextOut((page.GetWidth() - tw) / 2, (page.GetHeight() - 26) / 2 , text)
page.EndText()

pdf.Save("load_font_example.pdf")

pdf.Free()
23 changes: 23 additions & 0 deletions pdf.mod/examples/utf_example.bmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Framework Text.PDF

Local pdf:TPDFDoc = New TPDFDoc()
pdf.UseUTFEncodings()

Local font:TPDFFont = pdf.GetFont(pdf.LoadTTFontFromFile("FallingSky.ttf", True), "UTF-8")

Local page:TPDFPage = pdf.AddPage()
page.SetWidth(200)
page.SetHeight(200)
page.SetFontAndSize(font, 24)

Local text:String = "Testing ÅÄÖ"

Local tw:Float = page.TextWidth(text)

page.BeginText()
page.TextOut((page.GetWidth() - tw) / 2, (page.GetHeight() - 26) / 2 , text)
page.EndText()

pdf.Save("utf_example.pdf")

pdf.Free()
2 changes: 1 addition & 1 deletion pdf.mod/libharu/CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Version 2.2.0 (2010.10.12)
- Markup Annotations
- Free Text Annotations
- Line Annotations
- Circle and Squre Annotations
- Circle and Square Annotations
- Text Markup Annotations
- Rubber Stamp Annotations
- Popup Annotations
Expand Down
10 changes: 2 additions & 8 deletions pdf.mod/libharu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ include_directories(${PROJECT_SOURCE_DIR}/include)
# =======================================================================
# look for headers and libraries
# =======================================================================
include(haru)
include(summary)

# check zlib availability
Expand All @@ -70,11 +69,6 @@ endif(MSVC_VERSION GREATER 1399)
# Will export symbols to a .lib file on Windows
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)

# Just set to 1, we'll assume they are always available.
# If not, then someone will have to add some tests in here to correctly determine
# the headers existence.
set (LIBHPDF_STDC_HEADERS 1)

# support all of the different variations of LIBPNG defines in HARU
set (LIBHPDF_HAVE_LIBPNG ${PNG_FOUND})

Expand Down Expand Up @@ -140,8 +134,8 @@ set(
install(FILES ${haru_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# install various files
install(FILES README.md CHANGES INSTALL DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/libharu)
install(DIRECTORY bindings DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/libharu)
install(FILES README.md CHANGES DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(DIRECTORY bindings DESTINATION ${CMAKE_INSTALL_DOCDIR})

# =======================================================================
# print out some information
Expand Down
4 changes: 2 additions & 2 deletions pdf.mod/libharu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PDF. It supports the following features.
4. Embedding PNG, Jpeg images.
5. Embedding Type1 font and TrueType font.
6. Creating encrypted PDF files.
7. Using various character set (ISO8859-1~16, MSCP1250~8, KOI8-R).
7. Using various character set (ISO8859-1\~16, MSCP1250\~8, KOI8-R).
8. Supporting CJK fonts and encodings.

You can add the feature of PDF creation by using Haru without understanding
Expand Down Expand Up @@ -132,7 +132,7 @@ to the following restrictions:
We wish to thank all users of Haru.
In particular, we thank Thomas Nimstad, LeslieM, Par Hogberg, adenelson,
Riccardo Cohen, sea_sbs, Andrew.
They gave me very useful advices.
They gave me very useful advice.

3. Adobe Systems Inc.
We thank Adobe Systems Inc. for publishing PDF specification.
4 changes: 2 additions & 2 deletions pdf.mod/libharu/README_cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ You get a complete list of all available generators for your platform
with "cmake --help". I'll go into details for one specific compiler toolset.
The other generators work similar.

Using CMake to produce Visual C++ 2008 Makfiles
-----------------------------------------------
Using CMake to produce Visual C++ 2008 Makefiles
------------------------------------------------
First you need to have the command line interface setup correctly. Start
cmd.exe and run "%VS90COMNTOOLS%vsvars32.bat". This will set up the
command line tools of Visual C++ 2008. Cd into the created build
Expand Down
2 changes: 1 addition & 1 deletion pdf.mod/libharu/bindings/c#/demo/FontDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void Main() {
/* output subtitle. */
page.BeginText();
page.SetFontAndSize(def_font, 16);
page.TextOut(60, height - 80, "<Standerd Type1 fonts samples>");
page.TextOut(60, height - 80, "<Standard Type1 fonts samples>");
page.EndText();

page.BeginText();
Expand Down
2 changes: 1 addition & 1 deletion pdf.mod/libharu/bindings/delphi/LineDemo.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ begin
draw_line2 (page, 60, 505, 'PDF_ROUND_END');

HPDF_Page_SetLineCap (page, HPDF_PROJECTING_SQUARE_END);
draw_line2 (page, 60, 440, 'PDF_PROJECTING_SCUARE_END');
draw_line2 (page, 60, 440, 'PDF_PROJECTING_SQUARE_END');

{* Line Join Style *}
HPDF_Page_SetLineWidth (page, 30);
Expand Down
6 changes: 3 additions & 3 deletions pdf.mod/libharu/bindings/delphi/hpdf.pas
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface
HPDF_XObject = HPDF_HANDLE;
HPDF_Annotation = HPDF_HANDLE;
HPDF_ExtGState = HPDF_HANDLE;
HPDF_CHAR = PChar;
HPDF_CHAR = PAnsiChar;
HPDF_STATUS = Cardinal;

function HPDF_NewEx (user_error_fn: THPDF_ErrorFunc;
Expand Down Expand Up @@ -480,11 +480,11 @@ function HPDF_Font_GetCapHeight (font: HPDF_Font): HPDF_UINT;
stdcall external LIBHPDF_DLL;


function HPDF_Font_TextWidth (font: HPDF_Font; const text: PChar; len: HPDF_UINT): THPDF_TextWidth;
function HPDF_Font_TextWidth (font: HPDF_Font; const text: HDPF_Char; len: HPDF_UINT): THPDF_TextWidth;
stdcall external LIBHPDF_DLL;


function HPDF_Font_MeasureText (font: HPDF_Font; const text: PChar; len: HPDF_UINT;
function HPDF_Font_MeasureText (font: HPDF_Font; const text: HPDF_Char; len: HPDF_UINT;
width: HPDF_REAL; font_size: HPDF_REAL; char_space: HPDF_REAL;
word_space: HPDF_REAL; wordwrap: HPDF_BOOL; real_width: HPDF_PREAL) : HPDF_UINT;
stdcall external LIBHPDF_DLL;
Expand Down
6 changes: 3 additions & 3 deletions pdf.mod/libharu/bindings/oberon-2/test.ob2
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ BEGIN

h.HPDF_Page_SetFontAndSize (page, font, 10);

(* Draw verious widths of lines. *)
(* Draw various widths of lines. *)
h.HPDF_Page_SetLineWidth (page, 0);
draw_line (page, 60, 770, w.GetPSTR('������� ����� := 0'));

Expand Down Expand Up @@ -149,7 +149,7 @@ BEGIN
draw_line2 (page, 60, 505, w.GetPSTR('PDF_ROUND_END'));

h.HPDF_Page_SetLineCap (page, h.HPDF_PROJECTING_SQUARE_END);
draw_line2 (page, 60, 440, w.GetPSTR('PDF_PROJECTING_SCUARE_END'));
draw_line2 (page, 60, 440, w.GetPSTR('PDF_PROJECTING_SQUARE_END'));

(* Line Join Style *)
h.HPDF_Page_SetLineWidth (page, 30);
Expand Down Expand Up @@ -335,4 +335,4 @@ BEGIN
h.HPDF_SaveToFile (pdf, w.GetPSTR(fname));


END test.
END test.
2 changes: 1 addition & 1 deletion pdf.mod/libharu/bindings/python/demo/font_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def main ():
# output subtitle.
HPDF_Page_BeginText (page)
HPDF_Page_SetFontAndSize (page, def_font, 16)
HPDF_Page_TextOut (page, 60, height - 80, "<Standerd Type1 fonts samples>")
HPDF_Page_TextOut (page, 60, height - 80, "<Standard Type1 fonts samples>")
HPDF_Page_EndText (page)

HPDF_Page_BeginText (page)
Expand Down
4 changes: 2 additions & 2 deletions pdf.mod/libharu/bindings/python/demo/line_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def main ():
draw_line2 (page, 60, 505, "PDF_ROUND_END")

HPDF_Page_SetLineCap (page, HPDF_PROJECTING_SQUARE_END)
draw_line2 (page, 60, 440, "PDF_PROJECTING_SCUARE_END")
draw_line2 (page, 60, 440, "PDF_PROJECTING_SQUARE_END")

# Line Join Style
HPDF_Page_SetLineWidth (page, 30)
Expand Down Expand Up @@ -343,4 +343,4 @@ def main ():
return 0


main()
main()
2 changes: 1 addition & 1 deletion pdf.mod/libharu/bindings/ruby/demo/font_demo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
page.begin_text
page.text_out((width - tw) / 2, height - 50.0, title)
page.set_font_and_size(font1, 16.0)
page.text_out(60.0, height - 80.0, "<Standerd Type1 fonts samples>")
page.text_out(60.0, height - 80.0, "<Standard Type1 fonts samples>")
page.end_text

samp_text = "abcdefgABCDEFG12345!#$\%&+-@?"
Expand Down
Loading