We do not have a flutter web integration sample with pdf.js express. You can find all our samples available here: PDF.js Express · GitHub. Note that they could be using an older version of pdf.js
For adding additional icons in the toolbar, please follow our guide here:
I have managed to integrate with flutter, but having following issues
The exportannotations not providing the updated list after an event (annotation - add, modify or delete). We tried waiting the flutter app, also async/await in JS… but no luck. Always getting last result
We need to change 4 counters to different icons, please suggest best ways for it, also share available icon list
Added an action button on top, but I need it to active on when counter item selected
Change color of counter/annotation programatically
Option to hide dropdown and keep only measurement tools. Can I also hide entire toolbar?
How to hide the comment panel
How to fill color in annotation with opacity (from program)
Count tool is an extension of stickyCreate Tool, so you can modify the sticky annotations using their ‘color’ property, i.e.
StickyAnnotation.Color = new Annotations.Color(255, 255, 255)
To remove the thumbnail buttons, please follow the hiding UI elements guide: Hide & Disable Buttons in PDF.js Express Viewer | Documentation
Could you please clarify what you mean by adding a link dynamically to the thumbnails? Clicking on the thumbnail will navigate the viewer to its page.
pdf.js express does not support document manipulation, please see this post: insertBlankPages Example
Thank you. Can I draw an annotation programatically. Basically I want to modify an annotation by passing different square feet value (for example : annotation initially drawn is 80 sqft and I want pass 100 sqft to change it)
How can I apply fill color automatically when user a draw an item (the color should be the one they choose from toolsoverlay). If they select red color, then the fill color also should be red, if its green then fill also in green, if its blue fill color also blue. I need this for area, perimeter and arc measument
When you draw the annotation with the tool, the annotation will have a StrokeColor property. You can use that to set it as your FillColor on annotation creation event:
I need set scale button in toolbar. Click on it should trigger calibration, so the user can draw a distance which he know. From there we should be able to set scale using the distance drawn. How can i implement it in PDFExpress JS
I wanted to add the calibrate button on tool bar first
Then ask the user to draw a line (scale) on click of it. Then it should show him the measurement with unit(s) and let him to change if required. Then it should take user to scale popup with that measurement and set his scale
This would be a sample mock setup, could you please try something like this:
Add the Calibrate Button to the Toolbar
Since you’ve already added the calibrate button to the toolbar, ensure it’s properly linked to trigger the subsequent actions.
Click Event for Calibrate Button
instance.UI.setHeaderItems(header => {
const calibrateButton = {
type: 'actionButton',
img: '<icon_image_path>',
onClick: () => {
// Code to display the popup with instructions and measurement options
}
};
header.push(calibrateButton);
});
After the user clicks the calibrate button and the popup appears, they should be able to draw a line on the document.
Once the line is drawn, you need to calculate and display the measurement in a textbox. This can involve capturing the length of the line annotation and converting it to the desired unit.
annotationManager.addEventListener('annotationChanged', (annotations, action) => {
if (action === 'add') {
// Check if it's a line annotation
const lineAnnotation = annotations.find(annot => annot instanceof Annotations.LineAnnotation);
if (lineAnnotation) {
// Your code logic to calculate the measurement and display it in a textbox
}
}
});
The textbox should have an ‘Apply’ button. On clicking this, the entered measurement should be loaded into a scale popup window.
In the scale popup window, the user should be able to set the scale using the measurement from the calibrate step. They should also be able to define the actual measurement and select the precision level.