Print Page | Close Window

Mac RenderPagetoFile yield 0 byte file

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2962
Printed Date: 28 Apr 24 at 7:50PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Mac RenderPagetoFile yield 0 byte file
Posted By: eddy2099
Subject: Mac RenderPagetoFile yield 0 byte file
Date Posted: 28 Aug 14 at 8:08AM
I am a licensed user and running this code for the Mac under Delphi XE6 Firemonkey and using QuickPDF v10.16.

=
procedure TForm1.Button1Click(Sender: TObject);
var
orpdf : tdebenupdflibrary;
orpdfid,ordpageid,rendid : integer;
tdf,newfname : string;

begin
if OpenDialog1.execute then

begin
        tdf := OpenDialog1.FileName;
                        orpdf := TDebenuPDFLibrary.Create;
{$IFDEF MacOS}
orpdf.UnlockKey('[my mac key]’);
{$ELSE}
   orpdf.UnlockKey('[my win key]’);
{$ENDIF}
        orpdfid := orpdf.DAOpenFile(tdf,'');

                 
{$IFDEF MacOS}
            newfname := IncludeTrailingPathDelimiter(savein.Text)+'test'+'.jpg’;
{$ELSE}
              newfname := 'c:\test\test.jpg’;
{$ENDIF}
             ordpageid := orpdf.DAFindPage(orpdfid,1);
           rendid :=    orpdf.DARenderPageToFile(orpdfid,ordpageid,1,72,newfname);

ShowMessage(IntToStr(rendid));

                 end;
end;
=

Running under Windows, I can render my page to a JPG file and it works but when I compile for the Mac, I ended up getting a 0 byte JPEG file with nothing inside.

The same issue with rendering to TIFF or PNG. In the case of PNG, I do get a black page file.

I've tried the Dylib method with the same result.

==
type
   tsetkey = function(a : integer; key: pWidechar): integer; cdecl;
   tpdfcreate = function() : integer; cdecl;
    tpagecount = function(a : Integer) : Integer; cdecl;
    tdaopen =   function(a : Integer;filename : PWideChar;password : PWideChar) : integer; cdecl;
    tdafindpage = function(a : Integer; handle : integer; page : Integer) : integer; cdecl;
    trenderpagetofile = function(a : Integer; handle : Integer; pageref : integer;option : integer; dpi : Double; filename : PWideChar) : integer; cdecl;




procedure TForm1.dylibclickClick(Sender: TObject);
var

p, orpdfid,ordpageid : integer;
tdf,newfname : string;

setkey : tsetkey;
pdfcreate : tpdfcreate;
pagecount : tpagecount;
dafindpage : tdafindpage;
renderpagetofile : trenderpagetofile;
        openfile : tdaopen;
begin

    if OpenDialog1.execute then
        begin
            tdf := OpenDialog1.FileName;
ghandle := LoadLibrary(PChar('libDebenuPDFLibraryDylib1016.dylib')) ;

pdfcreate := GetProcAddress(ghandle,'DPLCreateLibrary');
    setkey := GetProcAddress(ghandle,'DPLUnlockKey');
    pagecount :=       GetProcAddress(ghandle,'DPLPageCount');
    dafindpage :=    GetProcAddress(ghandle,'DPLDAFindPage');
    renderpagetofile :=   GetProcAddress(ghandle,'DPLDARenderPageToFile');
        openfile := getprocaddress(ghandle,'DPLDAOpenFile');
   p := pdfcreate();
    setkey(p,PWideChar('[my mac key]'));
      newfname := IncludeTrailingPathDelimiter(ExtractFilePath(OpenDialog1.filename))+'test.png';
      orpdfid := openfile(p,PWideChar(tdf),PWideChar(''));
          ordpageid := dafindpage(p,orpdfid,1);
        renderpagetofile(p,orpdfid,ordpageid,5,72,PWideChar(newfname));

        end;

end;

==

I've contacted support about this matter and they reported that it worked without issue on their system so I am really at a lost. I am using Mac OS X 10.9.4 .

Am I doing anything wrong here ?

Thank you.



Replies:
Posted By: Kenneth488
Date Posted: 03 Oct 14 at 12:15PM
I have the same issue! Debenu is talking about an add-on, but as far as I have seen, it's only for windows.

http://www.debenu.com/kb/use-rendering-printing-add-debenu-quick-pdf-library/" rel="nofollow - http://www.debenu.com/kb/use-rendering-printing-add-debenu-quick-pdf-library/


Posted By: Chopinke
Date Posted: 08 Oct 14 at 8:20AM
Hi,

This is a little off topic, but why did they create a new rendering DLL? Why cannot they do the same stuff with the one built into the SDK?

I am heavily relying on the rendering part, so it would be a great disappointment if the DLL version could do something, that the SDK version couldn't.

Also many of us are not happy to include an additional to their distributable product.

Also a qestion: can I rename the DLL to MyProductRendering.DLL and still work?

Thanks!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk