RadaeePDF.com :: Topic: Reuse PageContent items (1/2)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Submit your requests and polls about new features
  • Page:
  • 1
  • 2

TOPIC: Reuse PageContent items

Reuse PageContent items 2 years 4 months ago #9250

  • alenz316
  • alenz316's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 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);
The administrator has disabled public write access.

Reuse PageContent items 2 years 4 months ago #9259

  • support
  • support's Avatar
  • OFFLINE
  • Administrator
  • Posts: 499
  • Thank you received: 42
  • Karma: 6
I'm sorry, may you better explain your needs? May be with a sample pdf file.
On which platform are you working?
The administrator has disabled public write access.

Reuse PageContent items 2 years 4 months ago #9261

  • alenz316
  • alenz316's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 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:
The administrator has disabled public write access.

Reuse PageContent items 2 years 4 months ago #9266

  • Davide
  • Davide's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 699
  • Thank you received: 53
  • Karma: 15
Hi,
I suggest you to look at this thread: www.radaeepdf.com/forum/Android-developm...ze-after-saving#9188
Last Edit: 2 years 4 months ago by Davide.
The administrator has disabled public write access.

Reuse PageContent items 2 years 4 months ago #9267

  • alenz316
  • alenz316's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
  • Karma: 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.
The administrator has disabled public write access.

Reuse PageContent items 2 years 4 months ago #9268

  • Davide
  • Davide's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 699
  • Thank you received: 53
  • Karma: 15
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();
Last Edit: 2 years 4 months ago by Davide.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Powered by Kunena Forum