#1 PDF Engine » Virus alert when installing .dll » 2019-07-26 08:36:27

Blanca
Replies: 2

Hello,

I've created a .dll using synopse project units and when i try to register my .dll it shows virus alert and don't let to register.
Does anybody  know something about this issue or how to resolve?

thank you very much.

Blanca

#2 PDF Engine » Create pdf from tiff w/o losing quality » 2019-07-19 11:57:16

Blanca
Replies: 0

Hello everybody,

I need to reduce pdf file size and i tried the following code.

 var TIFFImg:TTIFFImage;
    Filename,ImgOX : string;
    PDFImg:tpdfimage;
    stream:tfilestream;
    PDFGDI: TPdfDocumentGDI;
    PDFPage: TPdfpage;
    i:integer;
    jpeg:TJpegImage;
    wBMP: tbitmap;
 begin
    Filename := 'C:\TEMP\ScannedImage.pdf';
    TIFFImg:=TTIFFImage.Create;
    PDFGDI:=TPdfDocumentGDI.Create();
    Stream := TFileStream.Create(FileName, fmCreate);
    JPeg := TJPegImage.Create;
    wBMP := TBitmap.create;
    TIFFImg.LoadFromFile('C:\TEMP\ScannedImage.TIF');

    try
       PDFGDI.DefaultPaperSize:= psA4;
       PDFGDI.CompressionMethod:=cmFlateDecode;
       PDFGDI.GeneratePDF15File:=true;

       PDFGDI.ScreenLogPixels:= 72;
       PDFGDI.SaveToStreamDirectBegin(Stream);
       PDFGDI.ForceJPEGCompression := 60;

       for i:=0 to TIFFImg.GetPageCount-1 do
       begin
         TIFFImg.ActivePageIndex :=i;
         TIFFImg.ExtractPage(TIFFImg.ActivePageIndex, wBMP);
         Jpeg.Assign(wBMP);
         PDFGDI.DefaultPageWidth:=TIFFImg.Width;
         PDFGDI.DefaultPageHeight:=TIFFImg.Height;
         PDFPage:= PDFGDI.AddPage;
         PDFImg:= TPdfImage.Create(PDFGDI,Jpeg,true);
         ImgOx:='Im'+IntToStr(i);
         PDFGDI.AddXObject(ImgOx,PDFImg);
         PDFGDI.Canvas.DrawXObject(0,0, PDFGDI.DefaultPageWidth, PDFGDI.DefaultPageHeight, ImgOx);
         PDFGDI.SaveToStreamDirectPageFlush;
       end;
       PDFGDI.SaveToStreamDirectEnd;
     finally
       Stream.Free;
       PDFGDI.Free;
       TIFFImg.Free;
       jpeg.free;
     end;
end;

But althoug the file is very reduced, the quality in the output file is very bad. i've tried the same code without transforming to jpeg but the result is good quality too much size.
Is there any way to reduce pdf size? Thank you very much!

Board footer

Powered by FluxBB