Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7687219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:39:19+00:00 2026-05-31T19:39:19+00:00

Using Tinybutstrong and openTBS i created a script in PHP that opens multiple docx

  • 0

Using Tinybutstrong and openTBS i created a script in PHP that opens multiple docx templates and replaces a lot of variables with values from a database. In a nutshell clients can download their unique files, add information and pictures and upload them again. This works excellent. But of coarse i wouldn’t post here if there wasn’t some sort of problem.

Because of the barcodes (I am using barcode fonts and embed them in Word because the documents will be scanned far later in the process), the documents get huge. Instead of 100 KB average, they’ll easily get 7MB. This is a problem, because per year about 20.000 documents will be scanned. That’s an extra +/- 130 GB per year.

It’s a long story but we need docx, so we can’t simply replace it with some sort of PHP / MySQL template that would be far more efficient.

Word has the option to just embed the font symbols that are being used to cut on the size. But that isn’t an option, because the main template needs to have all chars available. It’s also not an option to send the font to the users, since there are +/- 20.000 new ones each year.

Is there another solution to cut the file size or use compression. Perhaps in Word, PHP, FTP, Apache?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:39:20+00:00Added an answer on May 31, 2026 at 7:39 pm

    I’m afraid the solution of using the option “Embed fonts in the file” with “Embed only characters used in the document” cannot be exploited. Ms Word saves the font using a special format with the extension ODTTF (for example, you have it in “word\fonts\font1.odttf”). But this format is binary, it seems badly documented and thus it stays as a proprietary format. Only Ms Word will be able to build such a sub-file.

    Since you haven’t any lighter font for the barcode, the only solution I can see is to use image instead of font for you barcode:

    • OpenTBS has a feature to easily replace a picture inside a DOCX file (parameter “op=changepic“).
    • Barcode2Image tools are easy to find in PHP. For example : Barcode Generator.

    Then you only have to code your process like this :

    1. Load the DOCX template,
    2. Create the temporary image of the barcode.
    3. Change the image inside the template.
    4. Merge the template, and save or send the result.
    5. Delete the temporary image.

    It’s important to delete the temporary image only after the final merge of the template, because OpenTBS actually inserts the image only when method $tbs->Show() is called.

    It’s also important to use a different temporary file for each merging because many merges can occur in the same time.

    If temporary files have a prefix or are saved into a dedicated directory, then it is advisable to clean up old temporary images regulary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Entity Framework CodeFirst, how do I create a created datetime column that gets
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
Using report builder 3.0, I have a report that queries a cube. How do
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter
Using CRM 4, I have an entity form that contains a tab with an
Using PHP and MySQL, I want to query a table of postings my users
using chrome 15 on osx 10.6.8 When adding event listeners, I've found that putting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.