Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Submit your requests and polls about new features

Reuse PageContent items

More
10 years 6 months ago #9250 by alenz316
We are adding a feature to have patterns in PDF's. This could be accomplished rather easily if a PageContent item can be reused and added to a page with a Matrix. Is there a way to do this?

e.g.
Code:
page.AddContent(content, false); content.GSSetMatrix(new com.radaee.pdf.Matrix(1f, 1f, 100, 100)); page.AddContent(content, false); content.GSSetMatrix(new com.radaee.pdf.Matrix(1f, 1f, 200, 200)); page.AddContent(content, true);
More
10 years 6 months ago #9259 by support
Replied by support on topic Reuse PageContent items
I'm sorry, may you better explain your needs? May be with a sample pdf file.
On which platform are you working?
More
10 years 6 months ago #9261 by alenz316
Replied by alenz316 on topic Reuse PageContent items
This is on Android.
I attached a screenshot of what I am trying to do. The left side is a pattern being rendered using an Android canvas, the right is the PDF that I am trying to draw the pattern to.

I am trying to create a PDF and use the same PageContent over and over like a stamp, using a Matrix to scale and translate it.

Is there a way add the content to a Page with a matrix, or post apply a Matrix to existing PageContent then add it to a Page?
More
10 years 6 months ago - 10 years 6 months ago #9266 by Davide
Replied by Davide on topic Reuse PageContent items
Hi,
I suggest you to look at this thread: www.radaeepdf.com/forum/Android-developm...ze-after-saving#9188
Last edit: 10 years 6 months ago by Davide.
More
10 years 6 months ago #9267 by alenz316
Replied by alenz316 on topic Reuse PageContent items
I looked at the thread, and it doesn't seem to answer my question. I may have overlooked something, but what I want to do is reuse PageContent.

I render a background 'tile' to a PageContent, then I want to add that PageContent multiple times to a Page, offsetting it each time to fill the entire Page.
More
10 years 6 months ago - 10 years 6 months ago #9268 by Davide
Replied by Davide on topic Reuse PageContent items
Hi,
in the thread I sent you, you can see how to add an image to a pdf.
If you want to use one page content and add it many times to the pdf, you can change the matrix and add the content using pageContent.DrawImage(rimage);

Here some example line of code :
Code:
File file = new File(Environment.getExternalStorageDirectory(), "/test_image.jpg"); Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); Page page = m_doc.GetPage(0); PageContent pageContent = new PageContent(); pageContent.Create(); pageContent.GSSave(); com.radaee.pdf.Matrix mat = new com.radaee.pdf.Matrix(200, 112.5f, 100, 300); pageContent.GSSetMatrix(mat); mat.Destroy(); Document.DocImage docimage = m_doc.NewImage(bitmap, true); Page.ResImage rimage = page.AddResImage(docimage); pageContent.DrawImage(rimage); pageContent.GSRestore(); boolean res = page.AddContent(pageContent, false); //change the matrix and re-add the same content com.radaee.pdf.Matrix mat1 = new com.radaee.pdf.Matrix(200, 112.5f, 300, 300); pageContent.GSSetMatrix(mat1); mat1.Destroy(); pageContent.DrawImage(rimage); pageContent.GSRestore(); boolean ress = page.AddContent(pageContent, false); pageContent.Destroy(); page.Close(); m_doc.Save();
Last edit: 10 years 6 months ago by Davide.
Time to create page: 0.546 seconds
Powered by Kunena Forum