You are not logged in.
Pages: 1
That's a possible solution but this means that I could not use precompiled DCUs in the IDE because I have ActiveX-DLLs, In-Proc-COM-Server-DLLs and normal EXEs.
In my opinion the best solution would be if the component take care of if running in a DLL and do the RegisterPictures somewhere else in code if this would be possible.
But this fix is not enough.
If USE_SYNGDIPLUS is defined in SynPDF then in the uses a
{$ifdef USE_SYNGDIPLUS}
SynGdiPlus, // use our GDI+ library for handling TJpegImage and such
{$else}
is done.
In SynGDIPlus the initialization looks like
initialization
Windows.InitializeCriticalSection(GdipCS);
{$ifndef NOTSYNPICTUREREGISTER}
Gdip.RegisterPictures; // will initialize the Gdip library if necessary
// GdipTest('d:\Data\Pictures\Sample Pictures\Tree.jpg');
{$endif}
and the RegisterPictures Creates the GDIPLus and we have the same problem again (Init of GDIPlus in dllmain).
This must be changed too. How?
And the speed of the functions is the only difference? No other functional differences?
If so I comment the usage of GDIPLus out by {.$define USE_SYNGDIPLUS}
But in spite of this I think the way SynPDF initialize the GDI+ should be changed (not inizialize it in initialization-part but when it first uses it)
Hello,
in the synpdf.pas in
initialization
{$ifdef USE_SYNGDIPLUS}
// initialize the Gdi+ library if necessary
if Gdip=nil then
Gdip := TGDIPlus.Create('gdiplus.dll');
{$endif}
the GDIPlus is created when the define is set.
This leads to trouble if the unit is used in a DLL since windows does not allow to initialize and deinitialize the gdiplus in dllmain ("Do not call GdiplusStartup or GdiplusShutdown in DllMain or in any function that is called by DllMain. If you want to create a DLL that uses GDI+, you should use one of the following techniques to initialize GDI+:", https://docs.microsoft.com/en-us/window … usstartup)
Two questions:
1. What is the reason for synpdf to use GDI+? Which functiosn depends on GDI+?
2. If GDI+ is essential needed for some functions then how could the code be changed to allow the usage in a DLL?
Greetings
Stefan
Hello,
thanks for the hint. Now memory comsumption is around 300 MB which is ok.
But the resulting PDF/A is not PDF/A-compliant.
Checking with Acrobat it says:
PDF-Document doesn't fit the PDF/A-1a(2005)-Standard.
Structured PDf-File:"Type"-entry is missing
How to fix that?
Greetings
Stefan
Hello,
I try to convert TIFF to PDF/A.
The code is very simple:
procedure Tiff2Pdf(const aTifFileList: TStrings; const aPdfFileName: string);
var
i, j: Integer;
s: AnsiString;
pdfDoc: TPdfDocument;
pdfpage: TPdfpage;
pdfImage: TPdfImage;
tifImage: TTIFFImage;
begin
pdfDoc := TPdfDocument.Create(False, 0, True, Nil);
try
pdfDoc.Info.Author:='';
pdfDoc.Info.Creator:='';
pdfDoc.DefaultPaperSize:=psA4;
pdfDoc.ForceJPEGCompression:=0;
pdfDoc.CompressionMethod:=cmFlateDecode;
tifImage := TTIFFImage.Create;
for i := 0 to aTifFileList.Count - 1 do begin
tifImage.LoadFromFile( aTifFileList[ i ] );
for j := 0 to tifImage.GetPageCount - 1 do begin
pdfpage := pdfDoc.AddPage;
pdfpage.PageWidth := Round(tifImage.Width *0.73);
pdfpage.PageHeight := Round(tifImage.Height * 0.73);
pdfImage := TPdfImage.Create(pdfDoc, tifImage, True);
s := AnsiString( Format( 'image_%.2d_%.2d', [i, j] ) );
pdfDoc.AddXObject( s, pdfimage );
pdfDoc.Canvas.DrawXObject( 0, 0, pdfpage.PageWidth, pdfpage.PageHeight, s );
end;
end;
pdfDoc.SaveToFile( aPdfFileName );
finally
pdfDoc.Free;
end;
end;
After the 4th page I get an "Out of Memory"-exception.
The whole demo-project is located under:
https://www.kic-software.de/Download/TestTif2Pdf.zip
Any ideas how to convert large TIFFs to PDF/A using the Synopse-library?
Greetings
Stefan
Hello,
I use the following code to convert a bunch of TIFF-Files to PDF/A-1b.
uses
SynPDF
, SynGdiPlus
;
procedure TForm1.Button1Click(Sender: TObject);
var
pdfDoc: TPdfDocument;
pdfpage: TPdfpage;
pdfImage: TPdfImage;
tiffimage: TTIFFImage;
i: integer;
begin
pdfDoc := TPdfDocument.Create(False, 0, True, Nil);
pdfDoc.Info.Author:='';
pdfDoc.Info.Creator:='';
pdfDoc.DefaultPaperSize:=psA4;
pdfDoc.ForceJPEGCompression:=0;
pdfDoc.CompressionMethod:=cmFlateDecode;
tiffimage := TTIFFImage.Create;
for i:=1 to 3 do begin
tiffimage.LoadFromFile(IntToStr(i)+'.tif');
pdfpage:=pdfDoc.AddPage;
pdfpage.PageWidth:=Round(tiffimage.Width *0.73);
pdfpage.PageHeight:=Round(tiffimage.Height * 0.73);
pdfImage:=TPdfImage.Create(pdfDoc,tiffimage,true);
pdfDoc.AddXObject('image'+AnsiString(IntToStr(i)), pdfimage);
pdfDoc.Canvas.DrawXObject(0,0,pdfpage.PageWidth,pdfpage.PageHeight,'image'+AnsiString(IntToStr(i)));
end;
pdfDoc.SaveToFile('output.pdf');
pdfDoc.Free;
end;
The code works fine and I get an PDF/A-1b but if I do a preflight-check with Adobe Acrobat to check the the PDF/A1-b compliance I get several errors:
The separator before 'endstream' must be an EOL. (4)
xmp:CreateDate :: Wrong value type. Expected type 'Date'.
xmp:ModifyDate :: Wrong value type. Expected type 'Date'.
The document does not conform to the requested standard.
The file format (header, trailer, objects, xref, streams) is corrupted.
The document's meta data is either missing or inconsistent or corrupt.
What must be done to produce a valid PDF/A?
Thanks
Stefan
Hello,
im absolutly new to Synopse (I just found it on google). I have TIFF-files which need to v´convert to PDF/A. Does anybody could point me to an example how to do this with Delphi XE?
Greetings
Stefan Westner
Pages: 1