Hi,
At the beginnig I would like to apologise for committing so late.
I had some problems with svnmerge and couldn't commit but
first I wanted to read a little more for this week's work to start
having ideas and working on the new code :).
I applied the changes joty asked about but I had some questions,
which you can find below.
I fixed also the bug giving 'the division by 0' error in Adobe Reader
(I simply check whether one of the dimensions is 0 and if that's the case
I return true as I think we can assume that plotting
the actually non-existing image was successful).
However, after doing so I got another error message caused by embedded
jpg's so I had to comment it out until I find out what's the problem.
on 2008/7/20 John Tytgat wrote:
> Use LOG() for reporting the error message. Is there anyway to recover
> instead of exit() (which is a no-go as this makes your browser go
> away) ? I believe Haru suggests setjmp/longjmp.
The exit was for debugging purposes only so I closed it in define's.
Is it OK if the error handler logs only the error and the cleaning etc. is done
where the function failed? This way we can avoid using setjmp/longjmp
which IMHO make the code less readable.
>> + switch(content->type){
>> + /*Handle "embeddable" types of images*/
>> + case CONTENT_JPEG:
>> + image = HPDF_LoadJpegImageFromMem(pdf_doc,
>> + content->source_data,
>> + content->total_size);
>> + break;
>> +
>> + /*Disabled until HARU PNG support will be more stable.
>
> What's the issue here ?
Here's a page generating errors with PNG enabled:
http://entropymine.com/jason/testbed/pngtrans/
>> [...]
>> +void pdf_end()
>> +{
>> +#ifdef PDF_DEBUG
>> + LOG(("pdf_end begins"));
>> + if (pdf_page != NULL) {
>> + HPDF_Page_GRestore(pdf_page);
>> + if (page_clipped)
>> + HPDF_Page_GRestore(pdf_page);
>> + pdf_plot_grid(10, 10, 0xCCCCCC);
>> + pdf_plot_grid(100, 100, 0xCCCCFF);
>> + }
>> +#endif
>> +
>> + if (settings->output)
>> + HPDF_SaveToFile(pdf_doc, settings->output);
>> + else
>> + HPDF_SaveToFile(pdf_doc, "out.pdf");
>
> Is it actual possible to have settings->output being NULL ? If so, better
> give an error message upfront and don't do any PDF generation at all as
> writing a file to whatever the current directory is, is not good.
What is the way of informing the user of non-critical errors?
>> + settings->scale = 0.7;
>
> Is there a specific reason for .7 scale ?
The pages look the best at this scale.
I added a comment in the code here
>> + cairo_set_line_width(gtk_print_current_cr, width);
>> + cairo_move_to(gtk_print_current_cr, x0, y0 - 0.5);
>> + cairo_line_to(gtk_print_current_cr, x1, y1 - 0.5);
>Could someone explain the 0.5 subtraction ? Just curious.
Here's the answer :) :
http://www.cairographics.org/FAQ/#sharp_lines