HaruPdf - HPDF_SaveToFile - cannot save a file with local national /unicode characters in the path or filename

225 views
Skip to first unread message

Zoran Sibinovic

unread,
Mar 16, 2019, 12:39:03 PM3/16/19
to Harbour Users
Hi to all,

By using in HPDF_SaveToFile for the 2nd parameter ex. this path/filename

c:\Users\Dragan Andrejević\AppData\Local\Temp\mypdffile.pdf

also for

c:\Users\Драган Андрејевић\AppData\Local\Temp\mypdffile.pdf

As It can be seen these paths are the users paths created second the users wishes and that I have to use as app temp folders.

Obviously the HaruPdf library in contribs cannot handle unicode characters in paths either in filenames.

I used as a solution the: save the file in some ex. mytemp folder and then copy it in the user temp folder since the COPY FILE  command works with these kinds of paths.

I also see on the net that  HPDF_SaveToFile can be done by using HPDF_SaveToStream with thr code below but I am not able to convert it for a prg usage.

/* save the document to a stream */
HPDF_SaveToStream (pdf);
fprintf (stderr, "the size of data is %d\n", HPDF_GetStreamSize(pdf));

HPDF_ResetStream (pdf); /* rewind the stream. */

/* get the data from the stream and output it to stdout. */
for (;;) {
    HPDF_BYTE buf[4096];
    HPDF_UINT32 siz = 4096;
    HPDF_STATUS ret = HPDF_ReadFromStream (pdf, buf, &siz);

    if (siz == 0)
        break;

    if (fwrite (buf, siz, 1, stdout) != 1) {
        fprintf (stderr, "cannot write to stdout", siz, wsiz);
        break;
    }
}
Grateful fo any suggestion/opinion/help about 
Thanks

Zoran



  

wen....@gmail.com

unread,
May 21, 2024, 5:22:45 AM5/21/24
to Harbour Users
Have you successfully tested HPDF_ReadFromStream()?

Zoran Sibinovic 在 2019年3月17日 星期日凌晨12:39:03 [UTC+8] 的信中寫道:

Zastava EFI

unread,
May 21, 2024, 9:38:29 AM5/21/24
to harbou...@googlegroups.com
You can change national characters to normal language characters without national...

Best Regards




--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/harbour-users/2b523d1a-c0dc-49ad-92b1-c541cb128469n%40googlegroups.com.

wen....@gmail.com

unread,
May 21, 2024, 11:24:22 AM5/21/24
to Harbour Users
Please, How to do?

Zastava EFI 在 2024年5月21日 星期二晚上9:38:29 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages