Posts

Showing posts with the label pdf

Determine Appropriate Font-Size for Text iTextSharp

Image
Background: I use CorelDraw a lot to lay out my reports before writing the iTextSharp code to generate them. It gives me a fair idea of how to position report elements and keeps me from doing guesses or trial and error. This was the case when I worked on the ID Card project for Delta State University: I had the ID card neatly laid out and the school loved the design. Issue: Now, everyone knows we normally have long names in Nigeria. My design template had a name that was 10 characters long and I used 28pt points for this text. What I wanted to achieve however is that, for names that will not be able to fit into the maximum space allowed for the name text at the 28pt used in the design template, the system should use the maximum font size that will permit the name to fit in the space available. Its a simple problem, but wasn't so easy to resolve. Solution: public Font GetSafeFont ( string DisplayText, Font FontToUse, float SafeLength, float StartingSize) {...

Enabling Write Access to A folder in IIS

Image
Issue Sometimes in web development, we may want to grant WRITE access to a folder probably for file upload purposes or mostly in my own case, PDF file generation purposes. The challenge however, is that all folders are read only which means your application will always throw errors whenever you attempt a write operation. Solution Locate the folder in windows explorer Right click on the folder and select properties In the securities tab, click edit, then click add in the new dialog box that shows up Type IIS AppPool\ApplicationPoolName (you need to replace ApplicationPoolName with the name of the application pool in IIS that your web app is running under) Click Check Names to resolve the name, then click Ok  Under permissions for ..., check Modify under allow.  Click Ok on all dialog boxes Note Some people will grant Modify or Full Control right to Everyone for the folder, note that this posses a huge security risk and should never be your approach to r...