Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Submit your requests and polls about new features
  • Page:
  • 1
  • 2

TOPIC:

Reuse PageContent items 9 years 4 months ago #9250

  • alenz316
  • alenz316's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
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.
      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);

Please Log in or Create an account to join the conversation.

Reuse PageContent items 9 years 4 months ago #9259

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 694
  • Thank you received: 59
I'm sorry, may you better explain your needs? May be with a sample pdf file.
On which platform are you working?

Please Log in or Create an account to join the conversation.

Reuse PageContent items 9 years 4 months ago #9261

  • alenz316
  • alenz316's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
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?
Attachments:

Please Log in or Create an account to join the conversation.

Reuse PageContent items 9 years 4 months ago #9266

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
I suggest you to look at this thread: www.radaeepdf.com/forum/Android-developm...ze-after-saving#9188

Please Log in or Create an account to join the conversation.

Last edit: by Davide.

Reuse PageContent items 9 years 4 months ago #9267

  • alenz316
  • alenz316's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
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.

Please Log in or Create an account to join the conversation.

Reuse PageContent items 9 years 4 months ago #9268

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
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 :
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();

Please Log in or Create an account to join the conversation.

Last edit: by Davide.
  • Page:
  • 1
  • 2
Powered by Kunena Forum