Loading...

Draw functions do not work

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Draw functions do not work

Postby Slava » Fri Jul 06, 2007 3:59 pm

Hi,

I dont get any errors, but no drawings either while using draw functions when making PDF from image (PdfDrawImage) or adding watermark to JPG (DrawText).

PDF comes out correct sized (pagesize = original image size), 600kb (like the original JPG) but empty.:?:

JPG comes out the same as input, no watermark, no changes.
Delphi JPG code:
Code: Select all
            oGdPicture.LoadFromFile(URL);
            oGdPicture.DrawText('Watermark', 10, 10, 10, 0, clRed);
            oGdPicture.SaveAsJpeg (URL+'_.jpg');
            oGdPicture.CloseNativeImage;


What can it be? do i do something wrong?

Slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Tue Jul 10, 2007 4:14 pm

Hi,

I think you are using a bad value into your clRed propertie. You have to use an ARGB color value and not simple RGB value.

http://www.gdpicture.com/faq.php#G3


To get a long argb color value you can use the ARGB() method.

The ARGB(nAlpha, nRed, nGreen, nBlue) method returns an ARGB long color value by using specified values for the alpha, red, green, and blue components.

Ex:

-To get the red color value:
nRedValue = object.ARGB(255, 255, 0, 0)



Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby Slava » Wed Jul 11, 2007 10:12 am

ok

oGdPicture.ColorGetARGBValueFromARGB( , , , ) has solved the problem with, JPG watermark.

i guess my problem with PDF differs from the above. Is there something wrong with this code? (delphi 7)
Code: Select all
  if oGdPicture.PdfNewPdf(PDFSaveUrl + '\Test.pdf', 'Title', 'Creator', 'Author', 'Producer') then
    oGdPicture.PdfSetCompressionLevel(9); //[0 to 9], 0 = no compression, 9 = best compression.
    oGdPicture.PdfSetMeasurementUnits(0);

    for i:=1 to scrollBoxThumbnails.ControlCount-1 do
        begin
          oGdPicture.PdfNewPage;
          nPdfImageID := oGdPicture.PdfAddImageFromImageID((((scrollBoxThumbnails.Controls[i] as TLMDBackPanel).Controls[0] as TLMDBackPanel).Controls[0] as TImage).Tag);
          nImageWidth := oGdPicture.PdfGetImageWidth(nPdfImageID);
          nImageHeight := oGdPicture.PdfGetImageHeight(nPdfImageID);
          oGdPicture.PdfSetPageDimensions(nImageWidth, nImageHeight);
          oGdPicture.PdfDrawImage(nPdfImageID, 0, 0, nImageWidth, nImageHeight);
          oGdPicture.PdfEndPage;
        end;
    oGdPicture.PdfSavePdf;

    if FileExists(PDFSaveUrl + '\Test.pdf') then ShowMessage('PDF OK'+#13+PDFSaveUrl + '\Test.pdf');


the strange thing is that oGdPicture successfully opens the image, because PdfGetImageWidth and PdfGetImageHeight show correct values...
but pdf is still empty
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Wed Jul 11, 2007 11:57 am

Hi,

Are you using the last edition ?

if it is the case you can send me your pdf file at esupport (at) gdpicture (dot) com.

Regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby Loïc » Wed Jul 11, 2007 2:34 pm

Ok I've understood your problem:

You can't use this method:

PdfAddImageFromImageID()

after this one:

PdfNewPage()

http://www.gdpicture.com/references/gdp ... ageID.html

All the used images must be added into the pdf before using the PdfNewPage() method !




You have to do something like that:

1- Creates your PDF
2- Add all your image
3- in a loop:

Create new page
Draw the desired image
End the Page

4- Close the PDF.


Best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest

cron