Synopse Open Source - Synopse PDF enginemORMot MVC / SOA / ORM and friends2024-02-02T17:08:25+00:00urn:md5:cc547126eb580a9adbec2349d7c65274DotclearData Alignment and Delphi 10.4.1urn:md5:d92b919fec1761d40f590fbb50daf53d2020-09-09T09:51:00+01:002021-02-22T08:42:27+00:00Arnaud BouchezSynopse PDF engine10.4.1alignmentblogbugDelphiEmbarcaderorecord <p>Some regression has been reported with Delphi 10.4.1 and SynPDF.</p>
<p>From the <a href="https://github.com/synopse/SynPDF/issues/40">Github issue description</a>:
<em>Generating a PDF via VLCCanvas and TPdfDocumentGDI causes access violation when compiled with Delphi 10.4.1 with record field alignment compiler option set to "byte" or "off". When this option is set to either of "word", "double word" or "quad word", the PDF gets created without errors. The same exact code works fine when compiled with Delphi 10.4 (patch 3), regardless of the field alignment flag.</em></p>
<p><img src="https://blog.synopse.info?post/public/blog/RegressionBug.jpeg" alt="" /></p>
<p>Sadly, I don't have access to Delphi 10.4.1 since I don't have any commercial licence, and I am waiting for the Community Edition - which is still 10.3 IIRC. So I couldn't debug the root cause and fill a JIRA ticket to EMB.
We tried to add a {$A+} at the beginning of the unit, to force the default record alignment. And it seemed to work.
So <a href="https://github.com/synopse/mORMot/commit/9cbf7732dd3f4967967ef70c49460e3e5978c077">we included the directive for all of our units, in the shared Synopse.inc file</a>, which is included in every of our source code units.</p>
<p>This blog entry is mainly to notify about this issue, and be able to share the solution/workaround we found, which could be investigated more deeply by Delphi users of the 10.4.1 revision. I guess that this problem may occur for other projects, when calling raw API.</p>
<p>Maybe it was a righteous fix introduced in 10.4.1, and the previous behavior of the compiler may have been incorrect: perhaps an explicit {$A+} is required when working with records... but at least, it breaks existing code, so spreading the info may help...</p>
<p><a href="https://synopse.info/forum/viewtopic.php?id=5569">So feedback is welcome in our forum, if you wish to</a>!</p>
<p><strong>Update</strong>:</p>
<p>It sounds definitively like a bug/regression of 10.4.1.
Reported initially as <a href="https://quality.embarcadero.com/browse/RSP-30787">RSP-30787</a> and more specifically <a href="https://blog.synopse.info?post/2020/09/09/as https://quality.embarcadero.com/browse/RSP-30890">RSP-30890</a>.
Thanks François and Stefan for the good investigation in <a href="https://en.delphipraxis.net/topic/3453-record-alignement-and-delphi-1041">Delphi Praxis</a>!</p>
<p>To be honest, setting an alignment to "byte" for a whole project is a pretty weird idea, and should never be done in practice.
Default alignment is good for performance and compatibility. If you need no alignment for a record or a class, just use {$A-} ...{$A+} locally.</p>SynPDF now generates (much) smaller PDF file sizeurn:md5:98e97b1180c900d4d395e7f09169603a2013-06-21T19:43:00+02:002013-06-22T19:09:24+02:00AB4327-GANDISynopse PDF engineblogDelphimORMotPDF<p>We have <a href="http://synopse.info/fossil/info/a6622c2901">reduced PDF
generated file size for all version of the PDF format</a>, by trimming any
uneeded space in the generated content.</p>
<p><img src="http://blog.amacpdf.com/wp-content/uploads/2012/12/compress-pdf.jpeg" alt="" /></p>
<p>We introduced a new optional <code>PDFGeneratePDF15File</code> property for
even better compression, using advanced features (<em>Object Streams</em> and
<em>Cross-Reference Streams</em>) of the PDF 1.5 format.<br />
This PDF 1.5 format needs Acrobot 6.0 and up to open them.<br />
Which should be the case on your computer.</p>
<p>Can be up to 70% smaller for a pdf with a lot of pages with simple textual
context.</p>
<p>I suspect our library is able to generate the smallest file size possible,
even in regard to other alternative libraries.<br />
Open Source can be great, can't it?</p> <p>We still have an issue which disallows to enable the full benefit of
<code>PDFGeneratePDF15File=true</code> when encryption is set.<br />
But even if the files may be a bit bigger in respect to when encryption is not
set, the generated content is still perfectly valid... and encrypted!<br />
If you have an idea about the problem cause, your feedback is welcome!</p>
<p>We can <a href="http://synopse.info/forum/viewtopic.php?id=1324">discuss on
our forum</a>.</p>SynPDF now implements 40 bit and 128 bit securityurn:md5:4d503a44fa3af80e99a910a9d681fbf12013-06-19T19:16:00+02:002013-06-19T19:16:00+02:00AB4327-GANDISynopse PDF engineblogDelphimORMotPDFsecurity<p>The trunk version of our <a href="http://synopse.info/fossil/wiki?name=PDF+Engine">Open Source <em>SynPdf</em>
library</a> now <a href="http://synopse.info/fossil/info/6822e8c67f">features
encryption using 40 bit or 128 bit key size</a>.</p>
<p><img src="http://www.verypdf.com/app/pdf-editor-toolkit/encrypt-pdf.jpg" alt="" /></p>
<p>This is a long awaiting feature, and sounds working just fine from my
tests.<br />
Speed has been optimized (as usual with our libraries), as a consequence
encrypting the content will only be slightly slower.</p> <p>In fact, <code>TPdfEncryption.New()</code> will create the expected
<code>TPdfEncryption</code> instance, depending on the supplied encryption
Level:</p>
<pre>
<strong>class function</strong> TPdfEncryption.New(aLevel: TPdfEncryptionLevel;
<strong>const</strong> aUserPassword, aOwnerPassword: <strong>string</strong>;
aPermissions: TPdfEncryptionPermissions): TPdfEncryption;
</pre>
<p>Here are some comments about this new method:</p>
<ul>
<li>to be called as parameter of
<code>TPdfDocument/TPdfDocumentGDI.Create(</code>)</li>
<li>currently, only <em>elRC4_40</em> and <em>elRC4_128</em> levels are
implemented</li>
<li>both passwords are expected to be ASCII-7 characters only</li>
<li><em>aUserPassword</em> will be asked at file opening: to be set to '' for
not blocking display, but optional permission</li>
<li><em>aOwnerPassword</em> shall not be '', and will be used internally to
cypher the pdf file content</li>
<li><em>aPermissions</em> can be either one of the <code>PDF_PERMISSION_ALL /
PDF_PERMISSION_NOMODIF / PDF_PERSMISSION_NOPRINT / PDF_PERMISSION_NOCOPY /
PDF_PERMISSION_NOCOPYNORPRINT</code> set of options</li>
</ul>
<p>In practice, typical use may be:</p>
<pre>
Doc := TPdfDocument.Create(false,0,false,
TPdfEncryption.New(elRC4_40,'','toto',PDF_PERMISSION_NOMODIF));
Doc := TPdfDocument.Create(false,0,false,
TPdfEncryption.New(elRC4_128,'','toto',PDF_PERMISSION_NOCOPYNORPRINT));
</pre>
<p><a href="http://synopse.info/fossil/wiki?name=Get+the+source">Follow this
link</a> to get the latest trunk (unstable) version.</p>
<p>Feedback is <a href="http://synopse.info/forum/viewtopic.php?id=1319">welcome on our forum, as
usual</a>!</p>Synopse PDF Engine 1.18urn:md5:e08d62456641ed00772f24a8c551faf72012-11-28T20:47:00+01:002012-11-28T21:01:32+01:00AB4327-GANDISynopse PDF engineDelphiPDFperformanceSourceSynopsezip <p>Our <em>SynPdf</em> library was released as part of every <em>mORMot</em>
version.<br />
But the stand-alone .zip was still in 1.15 revision.</p>
<p>I have updated it, and now it reflects the latest version from our source
code repository (i.e. 1.18).<br />
Open Source, working from Delphi 5 up to XE3.</p>
<p>Thanks to nice proposals - <a href="http://synopse.info/forum/viewtopic.php?id=932">like those from Sinasa</a> -
conversion engine from metafile content is pretty complete.<br />
Font fallback has been introduced for glyphs not available in the current font,
and some issues have been identified and fixed.<br />
<em>SynPdf</em> unit can now link to standard <em>ZLib.pas</em> unit if you
want to use it stand-alone and do not need our faster <em>SynZip.pas +
deflate.obj + trees.obj</em>.</p>
<p>Forum and feedback are <a href="http://synopse.info/forum/viewtopic.php?id=952">welcome on our
forum</a>.<br />
Direct download link is available in <a href="http://synopse.info/fossil/wiki?name=Downloads">our Download section</a>.</p>Synopse PDF Engine 1.15urn:md5:b99b8f22e12d89457e586154e3da91482011-09-25T10:49:00+02:002012-11-28T20:51:20+01:00AB4327-GANDISynopse PDF engineDelphiPDFSourceUnicode<p>For our PDF generation Open-Source library, this is a small fix update.</p>
<p>It can now be compiled under Delphi XE2.<br />
But it's still working from all previous IDE versions, starting with Delphi 5,
and still 100% free - released under GPL/LGPL/MPL license, choice is yours.</p> Source code is to be downloaded <a href="http://synopse.info/fossil/wiki?name=Downloads">from this page</a>.
<p>Feedback and questions are welcome on our forum, just as usual.<br />
See <a href="http://synopse.info/forum/viewtopic.php?id=447">http://synopse.info/forum/viewtopic.php?id=447</a></p>Synopse PDF Engine 1.14urn:md5:5db747b4b75326cf1fd04b7eda497d2d2011-07-02T19:51:00+02:002011-09-25T09:52:03+02:00AB4327-GANDISynopse PDF engineDelphiPDFSource <p>Our SynPdf unit has been updated to the 1.14 version.</p>
<p>Some enhancements:</p>
<ul>
<li>new SetCMYKFillColor and SetCMYKStrokeColor methods for TPdfCanvas</li>
<li>now handles EMR_POLYBEZIER* commands in conversion from meta file
content</li>
<li>fixed EZeroDivided error when enumerating
SetWindowExtEx(szlExtent(0,0))</li>
<li>some enhancements for better PDF/A-1 conformance to the standard: now
includes the ICC profile for RGB pictures; corrected /Link flag and XML
metadata; new header with 8 bit characters; correct outlines and other minor
issues: now pass e.g. <a href="https://blog.synopse.info?post/2011/07/02/www.pdf-tools.com/pdf/pdfa-online-pruefen.aspx">validation tests.</a></li>
</ul>
<p>Compatible with Delphi 5 up to Delphi XE.</p>
<p><a href="http://synopse.info/files/pdf/synpdf.zip">Source code released</a>
under GPL/LGPL/MPL license, on choice.<br />
That means: free, like a bird, and like a beer.</p>
<p>Comments and feedback are <a href="http://synopse.info/forum/viewtopic.php?pid=2247">welcome on our
forum.</a></p>Synopse PDF Engine 1.13urn:md5:f2d6144354f64072e031de6ba317e0012011-06-06T20:49:00+02:002011-07-02T18:52:06+02:00AB4327-GANDISynopse PDF engineDelphiPDFSourceUnicode<p>Our SynPdf unit has been refreshed to the 1.13 version.</p>
<ul>
<li>code modifications to compile with Delphi 5 compiler;</li>
<li>added horizontal scaling for GDI enumeration in case of text kerning
(could occur for small fonts);</li>
<li>fixed "Save when closing with Acrobat Reader X" - thanks to Ondrej for the
fix;</li>
<li>fixed clipping problems and vertical font positioning issue in
GDI enumeration - thanks to Ondrej for those corrections!</li>
</ul>
<div>Our pdf engine sounds almost stable by now.<br />
Thanks to the feedback provided by some user of this Open Source library!</div> <p>This version is mainly a bug fix, so has no major new feature.<br />
Some linked units, like <em>SynCommons</em> and <em>SynZip</em>, have been
updated to their latest 1.13 version.</p>
<p>Compatible with Delphi 5 up to Delphi XE.</p>
<p><a href="http://synopse.info/files/pdf/synpdf.zip">Source code released</a>
under GPL/LGPL/MPL license, on choice.<br />
That means: free, like a bird, and like a beer.</p>
<p>Comments and feedback <a href="http://synopse.info/forum/viewtopic.php?id=334">are welcome on our
forum</a>.</p>Synopse PDF Engine 1.12urn:md5:2d05687d5045650d58b3ab10d1c29ea02011-02-08T21:40:00+01:002011-06-06T17:52:25+02:00AB4327-GANDISynopse PDF engine<p>Our SynPdf unit has been refreshed to the 1.12 version.</p>
<p>The main enhancements are:</p>
<ul>
<li>Can now generate PDF/A-1 files;</li>
<li>Direct methods for creating bookmarks, links and document outline;</li>
<li>Document information can now be Unicode encoded;</li>
<li>The bitmaps can be cached and reused if drawn multiple times;</li>
<li>Some corrected issues.</li>
</ul> <p>Here are the detailed modifications (extracted from
<em>SynPdf.pas</em>):</p>
<ul>
<li>can now generate PDF/A-1 files if the new PDFA1 property is set to
true</li>
<li>new <em>CreateLink</em> and <em>CreateBookMark</em> methods for
<em>TPdfDocument</em>, to easily handle bookmarks and links</li>
<li>new <em>CreateOutline</em> method for <em>TPdfDocument</em>, for direct
outline adding </li>
<li>new <em>TPdfPage.PageLandscape</em> and
<em>TPdfDocument.DefaultPageLandscape</em> properties</li>
<li>can use <em>EMR_GDICOMMENT</em> to embed some <em>SynPDF</em> related data
(like bookmarks, links, and document outline) in the source
<em>TMetaFile</em> - used by <em>TSQLite3Pages</em></li>
<li>new <em>TPdfTextString</em> class, used to handle Unicode parameters (e.g.
in <em>TPdfInfo</em>, which properties are now handling unicode encoding
as expected)</li>
<li>new <em>CreateOrGetImage</em> method to easily add a bitmap to the page,
with internal caching: if the same bitmap content is sent more than once,
only one <em>TPDFImage</em> object will be used (used for emf
enumeration, e.g. <em>SQLite3Pages</em>)</li>
<li>now handle justified text from metafile (i.e. call to
<em>SetTextJustification</em> Windows API will change the PDF word space
as expected)</li>
<li>Uniscribe API now made public (and documented as such), for the
upcoming <em>TRenderPages</em></li>
<li>fixed memory leak in <em>TPdfOutlineRoot.Create</em></li>
<li>fixed issue in <em>TPdfDocumentGDI.VCLCanvasSize</em></li>
<li>fixed issue with fixed-width font unicode characters display</li>
<li><em>FontSub.dll</em> library is loaded only once for the whole
application</li>
</ul>
<p>Compatible with Delphi 6 up to Delphi XE.</p>
<p>Source code released under GPL/LGPL/MPL license, on choice.<br />
That means: free, like a bird, and like a beer.</p>
<p>Download, comments and feedback <a href="http://synopse.info/forum/viewtopic.php?id=220">are available on our
forum</a>.</p>Synopse PDF Engine 1.10urn:md5:d1cda42ee892fe7c83573fcd4deeacaf2010-10-24T09:58:00+02:002011-02-08T21:45:53+01:00AB4327-GANDISynopse PDF engine<p>The Synopse PDF Engine was just released under version 1.10</p>
<p>This Engine is a set of units, used in our SQLite3 database framework for
exporting reports in pdf format.<br />
But these units can be used stand-alone, in order to produce pdf files from
pure Delphi code.</p> <p>You can use direct pdf dedicated methods, or use a regular TCanvas to draw
your pdf pages. You can also first draw your content into a TMetaFile, then
create the pdf file from it.</p>
<p>Can optionally embed True Type font, or compress any bitmap image as
jpeg.<br />
Unicode ready (direct call of the UniScribe WinApi), e.g. handle Arabic
glyphs.<br />
A reporting engine is also available, for easy creation of reports from
code.</p>
<p>Here are the changes from version 1.8.8 to 1.10:<br />
- code modifications to compile with Delphi 6 compiler<br />
- new TPdfImage.CreateJpegDirect method and PixelWidth/PixelHeight
properties<br />
- synpdf.zip file now contains the SQLite3Pages unit, for easy report creation
from code (with antialiaised preview and on demand printing or pdf/txt
export)<br />
- crc32 is now coded in inlined fast asm (crc32.obj is no longer
necessary)<br />
- crc32 hashing is performed using 8 tables, for better CPU pipelining and
faster execution<br />
- crc32 tables are created on the fly during unit initialization, therefore it
saves 8 KB of code size from standard crc32.obj, with no speed penalty<br />
- both zip library obj files (i.e. deflate.obj and trees.obj) updated to
version 1.2.5</p>
<p>Compatible with Delphi 6 up to Delphi XE.</p>
<p>Source code released under GPL/LGPL/MPL license, on choice.<br />
That means: free, like a bird, and like a beer.</p>
<p>See <a href="http://synopse.info/forum/viewtopic.php?id=134">http://synopse.info/forum/viewtopic.php?id=134</a></p>htm2pdf free toolurn:md5:5ea939fb6312eaf00fbec568dc6e80722010-07-14T19:07:00+02:002011-01-23T12:48:54+01:00AB4327-GANDISynopse PDF engineblogDelphiGIFhtm2pdfPDFPNGSynopse<p>Using our SynPDF library and a public domain THtmlView component, and
discussion with some of our users, we were able to make a html to pdf
conversion tool.</p> <p>After <a href="http://synopse.info/forum/viewtopic.php?id=34">a discussion
with Pawel Stroinski</a> on our forum, the THtmlView component was used to make
a tool converting any html document into pdf, i.e. "printing" a html document
as a pdf.</p>
<p>I downloaded via SVN the <a href="http://code.google.com/p/thtmlviewer/">latest THtmlView source code available
from the successor of the well-known HTMLViewer components for Delphi</a>
(previously sold by <a href="http://www.pbear.com">PBear.com</a>), i.e.
r36.</p>
<p>Then I compiled it under Delphi 7. Some errors in the code. I therefore
fixed them. Then try to compile under Delphi 2010 - a lot of warnings, and some
main feature not working as expected (like css support). Fixed most bugs, and
made a lot of code refactoring - a lot of warning remains, and the component is
not truly Unicode: THtmlView use internaly UTF-8 encoding. But it works better
than the original version.</p>
<p>Then I used Pawel Stroinski's code using our <a href="http://synopse.info/forum/viewforum.php?id=1">SynPdf</a> unit to produce a pdf
file from any html content.</p>
<p>Some bitmaps where not printed: fixed some part of the <em>SynPdf</em>
library (now in version 1.8.3 in our source code repository).</p>
<p>And since the code from THtmlView did rely on jpeg.pas and was handling PNG
just with Delphi 2010, I added a compilation define (set by default) in order
to use our <a href="http://synopse.info/forum/viewforum.php?id=4">SynGdiPlus</a> library to read
GIF, PNG and JPEG files. So the resulting executable is smaller in size (less
than 890 KB), and work as expected. If you don't like all this, and need GIF
animated in your PDF (??? it's a joken pdf doesn't allow this), you can turn
the compilation define OFF, and use the previous code.</p>
<p>I've uploaded the source code in the <em>HtmlView</em> sub directory of our
<a href="http://synopse.info/fossil">Source Code Repository</a>.</p>
<p>You can download an executable file from<br />
<a href="http://synopse.info/files/pdf/htm2pdf.zip">http://synopse.info/files/pdf/htm2pdf.zip</a></p>
<p>Just extract the htm2pdf.exe file in a directory, then launch it:<br />
<br />
<a href="http://synopse.info/files/pdf/htm2pdf.png"><img src="http://synopse.info/files/pdf/htm2pdf.png" alt="" width="413" height="282" /></a><br />
<br />
Click on the "Open" button to open a html file, then browse it on the screen,
update the parameters below (like margins or paper size), and click on the
"Save as" or "Save" buttons.<br />
A pdf file will be created, containing the whole html content, together with
the files.</p>
<p>As a demo, I included in the <em>HtmlView/demo</em> sub directory of our
<a href="http://synopse.info/fossil">Source Code Repository</a> some html, css
and picture files. </p>
<p>You can download the resulting pdf from <a href="http://synopse.info/files/pdf/sample.pdf">http://synopse.info/files/pdf/sample.pdf</a></p>
<p>This <em>htm2pdf</em> tool can be used from the command line, without the
GUI window above:</p>
<p>1. you'll observe that the last used parameters are saved in a
<em>htm2pdf.ini</em> file in the same directory than the executable.</p>
<p>If you launch</p>
<div class="codebox">
<pre>
<code>htm2pdf /silent</code>
</pre></div>
<p>all parameters from htm2pdf.ini will be used, no GUI will be displayed, and
the conversion will be made.</p>
<p>2. you can force to specify a html source file name, and an optional
destination pdf file:</p>
<div class="codebox">
<pre>
<code>htm2pdf sample.htm</code>
</pre></div>
<p>will create a <em>sample.pdf</em> file in the same directory as
<em>sample.htm</em></p>
<div class="codebox">
<pre>
<code>htm2pdf sample.htm dest.pdf</code>
</pre></div>
<p>will create a <em>dest.pdf</em> file</p>
<p>This tool is released under the Public Domain, free but with no warranty at
all.</p>
<p><strong>Discussion and comments are welcome on our
forum:<br /></strong><a href="http://synopse.info/forum/viewtopic.php?pid=187"><strong>http://synopse.info/forum/viewtopic.php?pid=187</strong></a></p>Making report from codeurn:md5:03d09ba0b16975a399e84b348f069e4c2010-06-30T19:05:00+02:002012-06-13T07:56:12+02:00AB4327-GANDISynopse PDF engineblogDelphimORMotPDFSource<p>Did you notice the <code>SQLite3Pages</code> units?<br />
It's a reporting unit included in our <em>SQlite3/mORMot</em> framework, but it
can be used standalone...</p> You create your report from code, then you can preview it on the screen.
<div>You can then print or export the report as PDF. </div>
<div>Note that the report drawing uses GDI+, even if you embed .emf files or
TMetaFile in them: with antialiaising, they just look smooth on screen.
<p>Just right click on the report preview to see options.</p>
<pre>
<strong>procedure</strong> TForm1.btn1Click(Sender: TObject);
<strong>var</strong> i: integer;
<strong>begin</strong>
<strong>with</strong> TGDIPages.Create(self) <strong>do</strong>
<strong>try</strong>
<em>// the title of the report</em>
Caption := self.Caption;
<em>// now we add some content to the report</em>
BeginDoc;
<em>// header and footer</em>
AddTextToHeader(paramstr(0));
SaveLayout;
Font.Style := [fsItalic];
TextAlign := taRight;
AddTextToFooterAt('http://synopse.info',RightMarginPos);
RestoreSavedLayout;
AddTextToFooter(DateTimeToStr(Now));
<em>// main content (automaticaly split on next pages)</em>
NewHalfLine;
DrawTitle(edt1.Text,true);
<strong>for</strong> i := 1 <strong>to</strong> 10 <strong>do</strong>
DrawText('This is some text '+IntToStr(i));
NewLine;
AddColumns([10,20,50]);
AddColumnHeaders(['#','Two','Three'],true,true);
<strong>for</strong> i := 1 <strong>to</strong> 100 <strong>do</strong>
DrawTextAcrossCols([IntToStr(i),'Column '+IntToStr(i),'Some text here']);
NewLine;
DrawTitle('This is your text:');
DrawText(mmo1.Text);
EndDoc;
<em>// this method will show a preview form, and allow basic actions</em>
<em>// by using the right click menu</em>
ShowPreviewForm;
<strong>finally</strong>
Free;
<strong>end</strong>;
<strong>end</strong>;
</pre>
<p>It features the most exciting possibilities of <a href="https://blog.synopse.info?post/post/2011/02/08/Synopse-PDF-Engine-1.12">SynPdf</a>, i.e. fast and exact
creation, <code>TMetaFile</code> handling, <em>UniScribe</em> handling
(e.g. for Arabic), optional PDF/A-1 generation, bookmarks, outline and links,
document information, bitmap image reuse... See here a <a href="https://blog.synopse.info?post/public/Documents/SQLite3Pages_Test.pdf">Report from Code - PDF
export</a> generated by <code>TGdiPages</code>.</p>
<p>There is a preview window at hand.</p>
<p>Download link, and discussion in <a href="http://synopse.info/forum/viewtopic.php?id=41">our forum</a>.</p>
</div>Synopse PDF libray 1.8.1urn:md5:4882021738cc8455fc775d0db4b489c22010-06-30T11:12:00+02:002011-01-23T12:49:18+01:00AB4327-GANDISynopse PDF engineDelphiGDIPlusJPEGPDF<p>Our PDF engine has been updated, it's now on version 1.8.1.</p> Features added by contribution of REDDWARF / ONDREJ - THANKS!
<div><br />
Here are the modifications included in this release:</div>
<div><br />
- new feature: allow forced JPEG compression for graphics (useful if you want
to send your pdf files over the Internet);<br />
- new feature: UNDERLINE + STRIKEOUT support (also in RICH TEXT and rotated
text !);<br />
- new USE_SYNGDIPLUS conditional if you want to use the default jpeg unit
instead of our SynGdiPlus (but you loose TIF, PNG, and GIF support);<br />
- enhanced: PenWidth changed to Single -> better precision (e.g. for
underlined text);<br />
- fix issue: Rotated text was misplaced for some angles;<br />
- some small fixes about FillRect() + scaling, and move/line stroke.<br />
<br />
REDDWARF / ONDREJ shared a very good work - I just made some code
refactoring.<br />
Amazing contribution, in all cases. Hope will be useful.</div>
<div>That's the magic of open source...<br />
<div><br />
To download the updated full source code of this unit, see <a href="http://synopse.info/forum/viewtopic.php?pid=67">this forum topic</a>.</div>
</div>Synopse PDF engine 1.8urn:md5:cd62f2489c0067ea97f41c0481598e5f2010-06-22T21:50:00+02:002011-01-23T12:49:18+01:00AB4327-GANDISynopse PDF enginePDFTrueTypeUnicodeUniscribeOur PDF engine has been updated, it's now on version 1.8. Two new features were added:<br />
- font substitution if the font is not existing in the system (worse case will
use "Arial" for any not available font);<br />
- now handle ETO_GLYPH_INDEX in metafile rendering.
<p>Some obscure WinAnsi encoding / decoding to / from Unicode were also
identified and fixed (in SynCommons.pas unit).</p>
<p>See <a href="http://synopse.info/forum/viewtopic.php?id=28">the forum</a>
for details</p>Synopse PDF engine 1.7.2urn:md5:15ae23f57c89cfb424e08b69b986f6d62010-05-06T21:01:00+02:002011-01-23T12:49:18+01:00AB4327-GANDISynopse PDF engineArabicPDFTrueTypeUnicodeUniscribe<p>The Unicode part of the Synopse PDF engine has been updated in order to
support right-to-left languages and ligatures (i.e. glyph shaping).</p>
<p>Therefore, our Open Source engine is one of the few PDF producer able to
natively handle Arabic languages. Even most commercial engines don't implement
this nice feature.</p> <p>"Glyph Shaping" is needed e.g. for Arabic language, because the character
change its shape depending on its position in the word.</p>
<p>The Synopse PDF engine can now optionally call the Windows Uniscribe API, to
render Ordering (e.g. Left to Right direction) and Shaping of the text. The
USE_UNISCRIBE conditional must be defined, and the <em>UseUniscribe</em>
property of the <em>TPdfDocument</em> class must be set to true.</p>
<p>The <em>UseUniscribe</em> property can be temporary to TRUE, when
using the Canvas property, then back to FALSE when the Uniscribe API is not
needed any more. Windows Uniscribe library can be slower, that's the reason why
it is disabled by default.</p>
<p>Note that the <em>UseUniscribe</em> property must be set appropriately
before the content generation if you use any <em>TPdfDocumentGdi.VCLCanvas</em>
text output with such scripting (since the PDF rendering is done once just
before the saving, e.g. before <em>SaveToFile()</em> or <em>SaveToStream()</em>
methods calls).</p>
<p>Our Synopse PDF engine don't handle <a href="http://msdn.microsoft.com/en-us/library/dd374105%28v=VS.85%29.aspx">Font
Fallback</a> yet: the font you use must contain ALL glyphs necessary for the
supplied unicode text - squares or blanks will be drawn for any missing
glyph/character.</p>
<p>Using the Windows Uniscribe API is working very well (it is used internaly
by Windows for drawing complex text), is almost well documented on MSDN, but
there are very few sample code available. So writing this code was not so
easy... but I hope it will be useful for some users! Thanks Mahammed Nasman for
your comments and link to the <a href="http://msdn.microsoft.com/en-us/library/dd374091%28v=VS.85%29.aspx">MSDN
site</a>!</p>
<p>You can download the updated full source code of this unit, with other
needed Synopse units, from <a href="http://synopse.info/files/pdf/synpdf.zip">synpdf.zip</a> licensed under a
MPL/GPL/LGPL tri-license.<br />
<br />
The Unicode sample code has been updated also, and can be downloaded <a href="http://synopse.info/files/pdf/synpdfunicode.zip">from here</a>.</p>
<p>Here is the resulting PDF content. Feedback is welcome!</p>
<p><img title="ArabicUniscribe.png, mai 2010" alt="" src="https://blog.synopse.info?post/public/ArabicUniscribe.png" /></p>Synopse PDF engineurn:md5:62da2f8048730ac2137b77b3437691192010-05-03T20:51:00+02:002011-01-23T12:49:18+01:00AB4327-GANDISynopse PDF engineDelphiJPEGPDFPNGTrueTypeUnicode<p><strong>Synopse PDF engine</strong> is an Open Source PDF document creation
library for Delphi, embedded in one unit. It's used in the 1.7 version of
<a href="https://blog.synopse.info?post/category/Open-Source-Projects/SQLite3-Framework">SQLite3
framework</a>, for creating PDF files from reports.</p>
<p>Among its features, you can use a true <em>TCanvas</em> to create the PDF,
and embed True Type fonts subsets. Of course, it's Unicode ready, and licensed
under a MPL/GPL/LGPL tri-license.</p> <p>The <strong>Synopse PDF engine</strong> features:</p>
<ul>
<li>Create PDF documents containing text, graphics, and bitmaps;</li>
<li>Use a <em>TCanvas</em> instance to draw the page content with your VCL
code, just as usual (you can even use the Handle property of the
<em>TCanvas</em> to use low level GDI commands);</li>
<li>Automatic document Compression;</li>
<li>Embed JPG or BMP/GIF/PNG pictures (bitmaps are compressed into the PDF
content);</li>
<li>You can draw any EMF file or <em>TMetaFile</em> instance, which will be
converted to vectorial;</li>
<li>Fully handle Unicode text content;</li>
<li>Embed TrueType fonts, as a whole, or as a subset (i.e. only used glyphs are
stored into the PDF);</li>
<li>Easily add outlines or change page format;</li>
<li>PDF file content generation is very fast: after profiling, it appears that
the creation time is mostly spent in compression, not in content
generation;</li>
<li>Works in Delphi 7 up to 2010;</li>
<li>Whole engine is only one unit (i.e. no external dll is required), and
doesn't require our <a href="https://blog.synopse.info?post/category/Open-Source-Projects/SQLite3-Framework">SQLite3 database
framework</a>;</li>
<li>Freeware Opensource unit, licensed under a MPL/GPL/LGPL tri-license.</li>
</ul>
It's fully tested with Delphi 7. I need your feedback with Delphi
2009/2010.<br />
<br />
There are two ways of using this framework.<br />
<br />
1. Either directly (using the Canvas property, and its associated
methods):<br />
<pre>
with TPdfDocument.Create do<br />
try<br />
AddPage;<br />
Canvas.SetFont('georgia',12,[fsItalic,fsBold]);<br />
Canvas.TextOut(100,700,'Synopse PDF Engine Test');<br />
Canvas.TextOut(100,680,'Testé en Français');<br />
SaveToFile('testdirect.pdf');<br />
finally<br />
Free;<br />
end;
</pre>
Here is the resulting file: <a href="http://synopse.info/files/pdf/testdirect.pdf">testdirect.pdf</a><br />
<br />
2. Either by using a <em>TCanvas</em>, and VCL standard code:<br />
<pre>
with TPdfDocumentGDI.Create do<br />
try<br />
for i := 1 to 9 do begin<br />
AddPage;<br />
with VCLCanvas do begin<br />
Font.Name := 'Times new roman';<br />
Font.Size := 150;<br />
Font.Style := [fsBold,fsItalic];<br />
Font.Color := clNavy;<br />
TextOut(100,100,'Page '+IntToStr(i));<br />
end;<br />
end;<br />
SaveToFile('testvcl.pdf');<br />
finally<br />
Free;<br />
end;
</pre>
Here is the resulting file: <a href="http://synopse.info/files/pdf/testvcl.pdf">testvcl.pdf</a><br />
<br />
Of course, both way of creating the PDF content can be used at the same time in
your code, without any problem.<br />
<br />
You can download the full source code of this unit, with other needed Synopse
units, from <a href="http://synopse.info/files/pdf/synpdf.zip">synpdf.zip</a>
licensed under a MPL/GPL/LGPL tri-license.<br />
<br />
Luiz Américo has made some sample code about Unicode, which can be downloaded
<a href="http://synopse.info/files/pdf/synpdfunicode.zip">from here</a>.<br />
<br />
I'm some kind of proud about this code, especially the fast low level
CMAP4/TrueType part (for getting Unicode chars and their widths), the great
TrueType subsetting trick (which works under XP and later, for once Micro$oft
provided some useful API), and the way the <em>TCanvas/EMF/TMetaFile</em>
features are implemented. Feedback welcome!<br />