Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

how to refresh pdf page after add text

More
10 years 2 months ago #10096 by ankur123987
Hi Redaeepdf team,

I am trying to add text in pdf but I can't see the text at the same time. Until not scroll so how can I view the text while i add text.

Thanks,
More
10 years 2 months ago #10098 by Davide
Hi,
I suggest you to use :
Code:
vRenderSync( PDFVPage page )
or
Code:
vRenderAsync( PDFVPage page )


For more info check this:
More
10 years 2 months ago #10101 by ankur123987
thanks davide for your reply i tried above method but its not working the changes are not reflecting at screen

please view my source code and let me know what should i do?

PageContent content = new PageContent();
content.Create();//create content, do not forget.
content.GSSave();
Matrix mat = new Matrix( 1, 1, 100, 500 );
content.GSSetMatrix(mat);
mat.Destroy();

Page page = doc.GetPage(currentpage_num);


Document.DocFont dfont = doc.NewFontCID("DroidSansFallback", 1 | 8);//bold and embed in horizontal writing
ResFont rfont = page.AddResFont(dfont);

content.TextBegin();
content.TextSetFont(rfont, 20);//set font and size
content.SetFillColor(0xff9801);
content.SetStrokeColor(0x10);
content.TextSetCharSpace(0);
content.TextSetWordSpace(0.3f);
content.TextSetLeading(20);
content.TextSetRenderMode(2);//fill and stroke
content.TextSetHScale(120);//set horizontal scale
content.DrawText(getDate());
content.TextEnd();
content.GSRestore();

//add content to page
page.AddContent(content, true);
content.Destroy();
PDFView pdf= new PDFView(getApplicationContext());


PDFVPage pdfd= new PDFVPage(doc,currentpage_num);
pdf.vRenderAsync(pdfd);
More
10 years 2 months ago - 10 years 2 months ago #10120 by radaee
u shall do like:
Code:
PDFView pdf= new PDFView(getApplicationContext()); pdf.open(doc, ...);//set document object to view. //then add contents: PageContent content = new PageContent(); content.Create();//create content, do not forget. content.GSSave(); Matrix mat = new Matrix( 1, 1, 100, 500 ); content.GSSetMatrix(mat); mat.Destroy(); //too many lines, other adding codes; ....... PDFVPage vpage = pdf.vGetPage(currentpage_num); pdf.vRenderAsync(vpage); invalidate();//refresh to screen.
Last edit: 10 years 2 months ago by radaee.
More
10 years 2 months ago #10141 by ankur123987
Hi radaee, i tried your suggested code but i could nod find any open method in PDFView class. pdf.open(doc,...) does not works . however its content public void vOpen(Document doc, int page_gap, int back_color, PDFViewListener listener) i tried with this method too but no luck

one more thing invalidate() method is undefined in activity .please suggest any working code thanks
More
10 years 2 months ago - 10 years 2 months ago #10145 by radaee
sorry, may some misunderstood.
PDFView is not View class, but PDFReader extends from android.View.
ot better explan this, show sample codes in PDFReader class:
Code:
PDFPos pos = m_view.vGetPos((int)event.getX(), (int)event.getY()); PDFVPage vpage = m_view.vGetPage(pos.pageno); Page page = vpage.GetPage(); if( page != null ) { float pt[] = new float[2]; pt[0] = pos.x; pt[1] = pos.y; page.AddAnnotText(pt);//add a text note annotation. m_view.vRenderSync(vpage);//reflush to backing bitmap. if( m_listener != null ) m_listener.OnPageModified(vpage.GetPageNo());//display to screen, this is important. }
Last edit: 10 years 2 months ago by radaee.
Time to create page: 0.426 seconds
Powered by Kunena Forum