PDF page not rendering properly if the page is changed

2018-11-28 Thread Радомир Хаџић via gtk-app-devel-list
Hello.

I've sent as an attachment a code for a very simple PDF viewer. It is
not that well written but that's because I wanted it to be simple and
easy to understand. The purpose of the program is to illustrate a
problem that I'm having with my larger project.

The problem is that if a user changes page (by clicking "Previous
Page" or "Next Page") and the page when scaled accordingly is bigger
than the visible portion of the page rendering area (GtkDrawingArea),
then only the part of the page will render. You can try this yourself:
1. Open a document 2. Make sure that the next page is not completely
visible on the screen (so the scrollbars appear, this can be usually
achieved by clicking "Fit Width") 3. Click "Next page" and try
scrolling. You'll notice that one part of the page is not rendered.

So, why is this happening and how can I solve it? What also confuses
me is that rendering() function is definitely called when I scroll but
the page does not render (though it does render as it should when I
scroll the first page of a just opened document) properly, but if I
then resize the window the page renders properly.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: PDF page not rendering properly if the page is changed

2018-11-28 Thread Germán Poo-Caamaño
On Wed, 2018-11-28 at 17:17 +0100, Радомир Хаџић via gtk-app-devel-list 
wrote:
> Hello.
> 
> I've sent as an attachment a code for a very simple PDF viewer. It is
> not that well written but that's because I wanted it to be simple and
> easy to understand. The purpose of the program is to illustrate a
> problem that I'm having with my larger project.
> 
> The problem is that if a user changes page (by clicking "Previous
> Page" or "Next Page") and the page when scaled accordingly is bigger
> than the visible portion of the page rendering area (GtkDrawingArea),
> then only the part of the page will render. You can try this
> yourself:
> 1. Open a document 2. Make sure that the next page is not completely
> visible on the screen (so the scrollbars appear, this can be usually
> achieved by clicking "Fit Width") 3. Click "Next page" and try
> scrolling. You'll notice that one part of the page is not rendered.
> 
> So, why is this happening and how can I solve it? What also confuses
> me is that rendering() function is definitely called when I scroll
> but
> the page does not render (though it does render as it should when I
> scroll the first page of a just opened document) properly, but if I
> then resize the window the page renders properly.

I do not see any attachment.

My guess is: the page maybe cached somewhere, and it is reloaded (re-
rendered) when the view size changes.

-- 
Germán Poo-Caamaño
http://calcifer.org/
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: PDF page not rendering properly if the page is changed

2018-11-28 Thread Eric Cashon via gtk-app-devel-list
 

Didn't get an attachment either. Try something like the following and see if it 
makes any difference.

...
    GtkWidget *da=gtk_drawing_area_new();
    //Request a large drawing area.
    gtk_widget_set_size_request(da, 1, 1);

    GtkWidget *scroll=gtk_scrolled_window_new(NULL, NULL);
    gtk_widget_set_hexpand(scroll, TRUE);
    gtk_widget_set_vexpand(scroll, TRUE);
    gtk_container_add(GTK_CONTAINER(scroll), da);
...

Eric
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list