Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch to allow image sizes to be specified in "in", "mm", when using --browserwidth {high_dpi} #289

Open
michaelrsweet opened this issue Aug 2, 2016 · 5 comments
Labels
enhancement New feature or request priority-low
Milestone

Comments

@michaelrsweet
Copy link
Owner

Version: 1.8-current
Original reporter: Iain W. Bird

When using very high browserwidth options, e.g. to allow high DPI background images:

htmldoc --browserwidth 3307 --webpage test2.htm --outfile test2.pdf --size A4 --jpeg=70 --no-title

images become very small unless specified in percent.

This patch allows image sizes to be specified in "in", "mm" or "px" (96DPI). If units are not specified, the pre-existing behaviour is retained.

Use in HTML as follows, e.g.

TEST IMAGE SIZE NATIVE


TEST IMAGE SIZE 80%


TEST IMAGE SIZE 1 INCH

TABLE WIDTH 1in

TEST IMAGE SIZE 2x1 INCH

TABLE WIDTH 2in

TEST IMAGE HEIGHT 50mm


TEST IMAGE WIDTH 144pt


TEST IMAGE WIDTH 12pc


TEST IMAGE WIDTH 530px


TEST IMAGE WIDTH 530


Patch file has been tested under cygwin and MS-VC 2013 for the htmldoc executable

@michaelrsweet
Copy link
Owner Author

"htmldoc_imagesize_patch.diff":

Index: htmldoc/http.c
===================================================================
--- htmldoc/http.c	(revision 1736)
+++ htmldoc/http.c	(working copy)
@@ -211,6 +211,7 @@
   return (http);
 }
 
+#ifndef WIN32
 
 /*
  * 'httpAddCredential()' - Allocates and adds a single credential to an array.
@@ -246,6 +247,7 @@
   return (-1);
 }
 
+#endif
 
 /*
  * 'httpBlocking()' - Set blocking/non-blocking behavior on a connection.
@@ -401,6 +403,7 @@
   free(http);
 }
 
+#ifndef WIN32
 
 /*
  * 'httpCompareCredentials()' - Compare two sets of X.509 credentials.
@@ -425,6 +428,7 @@
   return (temp1 == temp2);
 }
 
+#endif
 
 /*
  * 'httpConnect()' - Connect to a HTTP server.
@@ -729,6 +733,7 @@
   return ((int)bytes);
 }
 
+#ifndef WIN32
 
 /*
  * 'httpFreeCredentials()' - Free an array of credentials.
@@ -753,6 +758,7 @@
   cupsArrayDelete(credentials);
 }
 
+#endif
 
 /*
  * 'httpGet()' - Send a GET request to the server.
@@ -2553,6 +2559,7 @@
   }
 }
 
+#ifndef WIN32
 
 /*
  * 'httpSetCredentials()' - Set the credentials associated with an encrypted
@@ -2577,6 +2584,7 @@
   return (http->tls_credentials ? 0 : -1);
 }
 
+#endif
 
 /*
  * 'httpSetCookie()' - Set the cookie value(s).
Index: htmldoc/http.h
===================================================================
--- htmldoc/http.h	(revision 1736)
+++ htmldoc/http.h	(working copy)
@@ -29,9 +29,17 @@
 #  ifdef WIN32
 #    ifndef __CUPS_SSIZE_T_DEFINED
 #      define __CUPS_SSIZE_T_DEFINED
+
+
 /* Windows does not support the ssize_t type, so map it to off_t... */
 typedef off_t ssize_t;			/* @private@ */
 #    endif /* !__CUPS_SSIZE_T_DEFINED */
+
+/* MSVC does not support __attribute__ */
+#	 ifndef __attribute__
+#    define __attribute__(x)
+#    endif
+
 #    include <winsock2.h>
 #    include <ws2tcpip.h>
 #  else
Index: htmldoc/hdstring.h
===================================================================
--- htmldoc/hdstring.h	(revision 1736)
+++ htmldoc/hdstring.h	(working copy)
@@ -95,7 +95,13 @@
 #    define vsnprintf hd_vsnprintf
 #  endif /* !HAVE_VSNPRINTF */
 
+/*
+ * trims a string to delimeter and collapses multiple spaces between into one
+ */
 
+extern
+void hd_trim_to_delim(char *strtrim, char delim);
+
 #  ifdef __cplusplus
 }
 #  endif /* __cplusplus */
Index: htmldoc/http-support.c
===================================================================
--- htmldoc/http-support.c	(revision 1736)
+++ htmldoc/http-support.c	(working copy)
@@ -509,7 +509,7 @@
   _cups_md5_state_t	md5state;	/* MD5 state */
   unsigned char		md5sum[16];	/* MD5 digest/sum */
 
-
+#ifndef WIN32
  /*
   * Build a version 3 UUID conforming to RFC 4122.
   *
@@ -524,6 +524,7 @@
   _cupsMD5Init(&md5state);
   _cupsMD5Append(&md5state, (unsigned char *)data, (int)strlen(data));
   _cupsMD5Finish(&md5state, md5sum);
+#endif
 
  /*
   * Generate the UUID from the MD5...
Index: htmldoc/htmldoc.h
===================================================================
--- htmldoc/htmldoc.h	(revision 1736)
+++ htmldoc/htmldoc.h	(working copy)
@@ -261,6 +261,10 @@
 
 extern char	*format_number(int n, char f);
 
+extern double	compute_size_units(char *axis_ptr, char *unit, int divisor);
+extern double	compute_size_multiunits(char *axis_ptr, int *p_units_specified);
+extern double	compute_size_multiunits_scaled(char *axis_ptr);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
Index: htmldoc/ps-pdf.cxx
===================================================================
--- htmldoc/ps-pdf.cxx	(revision 1736)
+++ htmldoc/ps-pdf.cxx	(working copy)
@@ -4290,16 +4290,16 @@
 	    else
 	    {
 	      if (strchr((char *)name, '%') != NULL)
-	        width = atoi((char *)name) * (*right - *left) / 100;
+		width = atoi((char *)name) * (*right - *left) / 100;
 	      else
-                width = atoi((char *)name) * PagePrintWidth / _htmlBrowserWidth;
+		width = compute_size_multiunits_scaled((char *)name);
             }
 
             if ((name = htmlGetVariable(t, (uchar *)"SIZE")) == NULL)
 	      height = 2;
 	    else
-	      height = atoi((char *)name) * PagePrintWidth / _htmlBrowserWidth;
-
+	      height = compute_size_multiunits_scaled((char *)name);
+	    
             switch (t->halignment)
 	    {
 	      case ALIGN_LEFT :
@@ -5639,7 +5639,7 @@
     if (var[strlen((char *)var) - 1] == '%')
       table_width = atof((char *)var) * (right - left) / 100.0f;
     else
-      table_width = atoi((char *)var) * PagePrintWidth / _htmlBrowserWidth;
+      table_width = compute_size_multiunits_scaled((char *)var);
   }
   else
     table_width = right - left;
@@ -5649,7 +5649,7 @@
     if (var[strlen((char *)var) - 1] == '%')
       table_height = atof((char *)var) * (top - bottom) / 100.0f;
     else
-      table_height = atoi((char *)var) * PagePrintWidth / _htmlBrowserWidth;
+      table_height = compute_size_multiunits_scaled((char *)var);
   }
   else
     table_height = -1.0f;
@@ -5952,7 +5952,7 @@
     if (var[strlen((char *)var) - 1] == '%')
       width = atof((char *)var) * (right - left) / 100.0f;
     else
-      width = atoi((char *)var) * PagePrintWidth / _htmlBrowserWidth;
+      width = compute_size_multiunits_scaled((char *)var);
   }
   else
   {
@@ -6320,7 +6320,7 @@
 	temp_height = atof((char *)height_var) * 0.01f *
 	              (PagePrintLength - 2 * cellpadding);
       else
-        temp_height = atof((char *)height_var) * PagePrintWidth / _htmlBrowserWidth;
+	temp_height = compute_size_multiunits_scaled((char *)height_var); 
 
       if (table_height > 0.0f && temp_height > table_height)
         temp_height = table_height;
@@ -6580,7 +6580,8 @@
         if (height_var[strlen((char *)height_var) - 1] == '%')
 	  temp_height = atof((char *)height_var) * 0.01f * PagePrintLength;
 	else
-          temp_height = atof((char *)height_var) * PagePrintWidth / _htmlBrowserWidth;
+	  temp_height = compute_size_multiunits_scaled((char *)height_var); 
+	  // atof((char *)height_var) * PagePrintWidth / _htmlBrowserWidth;
 
         if (table_height > 0 && temp_height > table_height)
           temp_height = table_height;
@@ -8829,7 +8830,7 @@
     if (var[strlen((char *)var) - 1] == '%')
       width = (right - left) * atoi((char *)var) * 0.01f;
     else
-      width = atoi((char *)var) * PagePrintWidth / _htmlBrowserWidth;
+      width = compute_size_multiunits_scaled((char *)var);
   }
   else
     width = 0.0f;
@@ -8847,7 +8848,7 @@
     if (var[strlen((char *)var) - 1] == '%')
       minh = PagePrintLength * atoi((char *)var) * 0.01f;
     else
-      minh = atoi((char *)var) * PagePrintWidth / _htmlBrowserWidth;
+      minh = compute_size_multiunits_scaled((char *)var);
   }
   else
     minh = 0.0f;
@@ -9160,7 +9161,8 @@
     if (var[strlen((char *)var) - 1] == '%')
       width = (right - left) * atoi((char *)var) * 0.01f;
     else
-      width = atoi((char *)var) * PagePrintWidth / _htmlBrowserWidth;
+      width = compute_size_multiunits_scaled((char *)var);
+
   }
   else
     width = 0.0f;
@@ -9175,7 +9177,7 @@
     if (var[strlen((char *)var) - 1] == '%')
       minh = PagePrintLength * atoi((char *)var) * 0.01f;
     else
-      minh = atoi((char *)var) * PagePrintWidth / _htmlBrowserWidth;
+	minh = compute_size_multiunits_scaled((char *)var);
   }
   else
     minh = 0.0f;
Index: htmldoc/util.cxx
===================================================================
--- htmldoc/util.cxx	(revision 1736)
+++ htmldoc/util.cxx	(working copy)
@@ -501,7 +501,129 @@
   }
 }
 
+/*
+* 'compute_size_units()' - Factors for "in", "mm", "px" and "cm" as unit sizes
+*/
 
+double
+compute_size_units(char *axis_ptr, char *unit, int divisor)
+{
+    int	slen;
+    int	ulen;
+    double	units;
+
+    slen = strlen((char *)axis_ptr);
+    ulen = strlen(unit);
+
+    if (slen > ulen && strstr(axis_ptr + slen - ulen, unit))
+    {
+	units = (int)(atof(axis_ptr) * (double)_htmlPPI / ((double)divisor));
+    }
+    else
+    {
+	units = 0;
+    }
+    return units;
+}
+
+double
+compute_size_multiunits(char *axis_ptr,
+int *p_units_specified)
+{
+    char	*ci_axis_ptr;
+    char	*p, *q;
+    int	alen;
+    size_t	max_elements;
+    double	units;
+    char	ci_axis[256];
+
+    max_elements = 255;
+    *p_units_specified = 1;
+
+    units = 0.0f;
+    alen = strnlen(axis_ptr, max_elements);
+
+    if (alen && alen < max_elements)
+    {
+	q = ci_axis;
+	p = axis_ptr;
+	while (*p)
+	{
+	    *q++ = tolower(*p++);
+	}
+	*q = '\0';
+
+	/* specify all units in lower case */
+
+	switch (0)
+	{
+	    /*
+	    * We're not really switching, but want to abuse
+	    * the "break;" keyword
+	    *
+	    */
+
+	default:
+	    units = compute_size_units(ci_axis, "px", 96.0f);
+	    if (units > 0.0f)
+		break;
+
+	    units = compute_size_units(ci_axis, "in", 1.0f);
+	    if (units > 0.0f)
+		break;
+
+	    units = compute_size_units(ci_axis, "mm", 25.4f);
+	    if (units > 0.0f)
+		break;
+
+	    units = compute_size_units(ci_axis, "cm", 2.54f);
+	    if (units > 0.0f)
+		break;
+
+	    units = compute_size_units(ci_axis, "pc", 6.0f);
+	    if (units > 0.0f)
+		break;
+
+	    units = compute_size_units(ci_axis, "pt", 72.0f);
+	    if (units > 0.0f)
+		break;
+
+	    units = compute_size_units(ci_axis, "q", 101.6f);
+	    if (units > 0.0f)
+		break;
+
+	    /*
+	    * Just assume it's raw as a fall back to retain
+	    * initial backward compatibility behaviour
+	    * where e.g. --browserwidth, is 3307 for
+	    * 400 DPI A4
+	    */
+	    units = (int)(atof(axis_ptr) * (double) 72.0f / (double)_htmlPPI);
+
+	    /* Allow % as no units specified */
+	    *p_units_specified = 0;
+	    break;
+	}
+    }
+
+    return units;
+}
+
+double
+compute_size_multiunits_scaled(char *axis_ptr)
+{
+    int	units_specified;
+    double	units;
+
+    units = compute_size_multiunits(axis_ptr, &units_specified);
+    if (units_specified)
+    {
+	units *= (double) 72.0f / (double)_htmlPPI;
+    }
+    return units;
+}
+
+
 /*
  * End of "$Id$".
  */
Index: htmldoc/string.c
===================================================================
--- htmldoc/string.c	(revision 1736)
+++ htmldoc/string.c	(working copy)
@@ -206,7 +206,118 @@
 }
 #endif /* !HAVE_STRLCPY */
 
+/*
+ * trims a string to delimeter and collapses multiple spaces between into one
+ *
+ * WARNING:
+ *
+ *	self-overwrites the source string
+ *
+ * Used for processing font names with spaces e.g. "Arial Narrow,Helvetica-Narrow"
+ * 
+ * Removes leading spaces and multiple redundant delimiters
+ * e.g. " ,, Arial Narrow  , Helvetica-Narrow,"
+ * 
+ */
 
+void hd_trim_to_delim(char *strtrim, char delim)
+{
+	char *p;
+	char *q;
+
+	int blnDelimFound = 0;
+	int blnSpaceFound = 0;
+	int blnValid = 0;
+
+	p = q = strtrim;
+
+	/* treat first part as if we have just found a delimiter */
+
+	while (*p)
+	{
+		blnDelimFound = 1;
+		while (*p && blnDelimFound)
+		{
+			if (isspace(*p))
+			{
+				/* Consume leading whitespace */
+				p++;
+			}
+			else if (*p == delim)
+			{
+				/* consume excess delimeters */
+				p++;
+			}
+			else
+			{
+				blnDelimFound = 0;
+				blnSpaceFound = 0;
+				/* we've found a valid character */
+				*q++ = *p++;
+				blnValid = 1;
+			}
+		}
+
+		/* now copy characters across until the next delimiter */
+		blnSpaceFound = 0;
+		while (*p && !blnDelimFound)
+		{
+			if (isspace(*p))
+			{
+				if (!blnSpaceFound)
+				{
+					*q++ = ' ';
+					blnSpaceFound = 1;
+				}
+				p++;
+			}
+			else if (*p == delim)
+			{
+				blnDelimFound = 1;
+
+				if (blnSpaceFound)
+				{
+					/* remove the trailing space */
+					*--q = '\0';
+					blnSpaceFound = 0;
+				}
+
+				*q++ = *p++;
+			}
+			else
+			{
+				blnSpaceFound = 0;
+				*q++ = *p++;
+			}
+		}
+	}
+	if (blnValid)
+	{
+		if (blnDelimFound)
+		{
+			/* remove the trailing space */
+			*--q = '\0';
+			blnDelimFound = 0;
+		}
+		else if (blnSpaceFound)
+		{
+			/* remove the trailing space */
+			*--q = '\0';
+			blnSpaceFound = 0;
+		}
+		*q = '\0';
+	}
+	else
+	{
+		q = strtrim;
+		if (q)
+		{
+			*q = '\0';
+		}
+	}
+}
+
+
 /*
  * End of "$Id$".
  */
Index: htmldoc/htmllib.cxx
===================================================================
--- htmldoc/htmllib.cxx	(revision 1736)
+++ htmldoc/htmllib.cxx	(working copy)
@@ -260,6 +260,7 @@
 static void	insert_space(tree_t *parent, tree_t *t);
 static int	parse_markup(tree_t *t, FILE *fp, int *linenum);
 static int	parse_variable(tree_t *t, FILE *fp, int *linenum);
+
 static int	compute_size(tree_t *t);
 static int	compute_color(tree_t *t, uchar *color);
 static int	get_alignment(tree_t *t);
@@ -2949,60 +2950,98 @@
 static int			/* O - 0 = success, -1 = failure */
 compute_size(tree_t *t)		/* I - Tree entry */
 {
-  uchar		*ptr;		/* Current character */
-  float		width,		/* Current width */
+	uchar		*ptr;		/* Current character */
+	float		width,		/* Current width */
 		max_width;	/* Maximum width */
-  uchar		*width_ptr,	/* Pointer to width string */
+	uchar		*width_ptr,	/* Pointer to width string */
 		*height_ptr,	/* Pointer to height string */
 		*size_ptr,	/* Pointer to size string */
 		*type_ptr;	/* Pointer to spacer type string */
-  image_t	*img;		/* Image */
-  char		number[255];	/* Width or height value */
+	image_t	*img;		/* Image */
+	char		number[255];	/* Width or height value */
 
+	int		units_specified;
 
-  if (!_htmlInitialized)
-    htmlSetCharSet("iso-8859-1");
+	if (!_htmlInitialized)
+		htmlSetCharSet("iso-8859-1");
 
-  if (t->markup == MARKUP_IMG)
-  {
-    width_ptr  = htmlGetVariable(t, (uchar *)"WIDTH");
+	if (t->markup == MARKUP_IMG)
+	{
+    width_ptr = htmlGetVariable(t, (uchar *)"WIDTH");
     height_ptr = htmlGetVariable(t, (uchar *)"HEIGHT");
 
     img = image_load((char *)htmlGetVariable(t, (uchar *)"REALSRC"),
-                     _htmlGrayscale);
+	    _htmlGrayscale);
 
     if (width_ptr != NULL && height_ptr != NULL)
     {
-      t->width  = atoi((char *)width_ptr) / _htmlPPI * 72.0f;
-      t->height = atoi((char *)height_ptr) / _htmlPPI * 72.0f;
+      t->width = compute_size_multiunits((char *)width_ptr, &units_specified);	// atoi((char *)width_ptr) / _htmlPPI * 72.0f;
 
+      if (units_specified)
+      {
+	    /* Some kind of unit was specified, so reset the htmlVariables */
+	    sprintf(number, "%d", (int)t->width);
+	    htmlSetVariable(t, (uchar *)"WIDTH", (uchar *)number);
+      }
+      t->height = compute_size_multiunits((char *)height_ptr, &units_specified);	// atoi((char *)height_ptr) / _htmlPPI * 72.0f;
+      if (units_specified)
+      {
+	    sprintf(number, "%d", (int)t->height);
+	    htmlSetVariable(t, (uchar *)"HEIGHT", (uchar *)number);
+
+      }
       return (0);
     }
 
     if (img == NULL)
-      return (-1);
+	    return (-1);
 
     if (width_ptr != NULL)
     {
-      t->width  = atoi((char *)width_ptr) / _htmlPPI * 72.0f;
+      t->width = compute_size_multiunits((char *)width_ptr, &units_specified);	// atoi((char *)width_ptr) / _htmlPPI * 72.0f;
       t->height = t->width * img->height / img->width;
 
-      sprintf(number, "%d",
-              atoi((char *)width_ptr) * img->height / img->width);
-      if (strchr((char *)width_ptr, '%') != NULL)
-        strlcat(number, "%", sizeof(number));
-      htmlSetVariable(t, (uchar *)"HEIGHT", (uchar *)number);
+      if (!units_specified)
+      {
+	    sprintf(number, "%d",
+		    atoi((char *)width_ptr) * img->height / img->width);
+	    if (strchr((char *)width_ptr, '%') != NULL)
+		    strlcat(number, "%", sizeof(number));
+      }
+      else
+      {
+	    sprintf(number, "%d",
+		    (int)t->width * img->height / img->width);
+	    htmlSetVariable(t, (uchar *)"HEIGHT", (uchar *)number);
+
+	    sprintf(number, "%d", (int)t->width);
+	    htmlSetVariable(t, (uchar *)"WIDTH", (uchar *)number);
+      }
     }
     else if (height_ptr != NULL)
     {
-      t->height = atoi((char *)height_ptr) / _htmlPPI * 72.0f;
-      t->width  = t->height * img->width / img->height;
+      t->height = compute_size_multiunits((char *)height_ptr, &units_specified);	// atoi((char *)height_ptr) / _htmlPPI * 72.0f;
+      t->width = t->height * img->width / img->height;
 
-      sprintf(number, "%d",
-              atoi((char *)height_ptr) * img->width / img->height);
-      if (strchr((char *)height_ptr, '%') != NULL)
-        strlcat(number, "%", sizeof(number));
-      htmlSetVariable(t, (uchar *)"WIDTH", (uchar *)number);
+      if (!units_specified)
+      {
+	    sprintf(number, "%d",
+		    atoi((char *)height_ptr) * img->width / img->height);
+	    if (strchr((char *)height_ptr, '%') != NULL)
+		    strlcat(number, "%", sizeof(number));
+
+
+      }
+      else
+      {
+	    sprintf(number, "%d",
+		    (int)t->height * img->width / img->height);
+
+	    htmlSetVariable(t, (uchar *)"WIDTH", (uchar *)number);
+
+	    sprintf(number, "%d", (int)t->height);
+	    htmlSetVariable(t, (uchar *)"HEIGHT", (uchar *)number);
+      }
     }
     else
     {
Index: vcnet/htmldoc.sln
===================================================================
--- vcnet/htmldoc.sln	(revision 1736)
+++ vcnet/htmldoc.sln	(working copy)
@@ -1,25 +1,16 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghtmldoc", "ghtmldoc.vcproj", "{A45127A6-7A50-48AE-820A-E0D821516AD4}"
-	ProjectSection(ProjectDependencies) = postProject
-		{1132A142-F8A1-4464-881C-7F50D77A1CD2} = {1132A142-F8A1-4464-881C-7F50D77A1CD2}
-		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58} = {07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}
-		{287D2FB4-9941-4B64-B973-55A6EC04EAFC} = {287D2FB4-9941-4B64-B973-55A6EC04EAFC}
-		{F4B8B6F3-8198-4FC3-92A3-C944644B570A} = {F4B8B6F3-8198-4FC3-92A3-C944644B570A}
-	EndProjectSection
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.40629.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghtmldoc", "ghtmldoc.vcxproj", "{A45127A6-7A50-48AE-820A-E0D821516AD4}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "htmldoc", "htmldoc.vcproj", "{287D2FB4-9941-4B64-B973-55A6EC04EAFC}"
-	ProjectSection(ProjectDependencies) = postProject
-		{1132A142-F8A1-4464-881C-7F50D77A1CD2} = {1132A142-F8A1-4464-881C-7F50D77A1CD2}
-		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58} = {07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}
-		{F4B8B6F3-8198-4FC3-92A3-C944644B570A} = {F4B8B6F3-8198-4FC3-92A3-C944644B570A}
-	EndProjectSection
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "htmldoc", "htmldoc.vcxproj", "{287D2FB4-9941-4B64-B973-55A6EC04EAFC}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "jpeg.vcproj", "{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg", "jpeg.vcxproj", "{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libpng.vcproj", "{1132A142-F8A1-4464-881C-7F50D77A1CD2}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libpng.vcxproj", "{1132A142-F8A1-4464-881C-7F50D77A1CD2}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcproj", "{F4B8B6F3-8198-4FC3-92A3-C944644B570A}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcxproj", "{F4B8B6F3-8198-4FC3-92A3-C944644B570A}"
 EndProject
 Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "htmldoc-installer", "htmldoc-installer.vdproj", "{CE7334CB-F82B-4F29-8648-D959871BBC71}"
 	ProjectSection(ProjectDependencies) = postProject
@@ -30,33 +21,57 @@
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Debug|Win32.ActiveCfg = Debug|Win32
 		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Debug|Win32.Build.0 = Debug|Win32
+		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Debug|x64.ActiveCfg = Debug|x64
+		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Debug|x64.Build.0 = Debug|x64
 		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Release|Win32.ActiveCfg = Release|Win32
 		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Release|Win32.Build.0 = Release|Win32
+		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Release|x64.ActiveCfg = Release|x64
+		{A45127A6-7A50-48AE-820A-E0D821516AD4}.Release|x64.Build.0 = Release|x64
 		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Debug|Win32.ActiveCfg = Debug|Win32
 		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Debug|Win32.Build.0 = Debug|Win32
+		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Debug|x64.ActiveCfg = Debug|x64
+		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Debug|x64.Build.0 = Debug|x64
 		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Release|Win32.ActiveCfg = Release|Win32
 		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Release|Win32.Build.0 = Release|Win32
+		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Release|x64.ActiveCfg = Release|x64
+		{287D2FB4-9941-4B64-B973-55A6EC04EAFC}.Release|x64.Build.0 = Release|x64
 		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Debug|Win32.ActiveCfg = Debug|Win32
 		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Debug|Win32.Build.0 = Debug|Win32
+		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Debug|x64.ActiveCfg = Debug|x64
+		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Debug|x64.Build.0 = Debug|x64
 		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Release|Win32.ActiveCfg = Release|Win32
 		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Release|Win32.Build.0 = Release|Win32
+		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Release|x64.ActiveCfg = Release|x64
+		{07169A72-08A9-4EC8-BC6C-CCBC1F01EA58}.Release|x64.Build.0 = Release|x64
 		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Debug|Win32.Build.0 = Debug|Win32
+		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Debug|x64.ActiveCfg = Debug|x64
+		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Debug|x64.Build.0 = Debug|x64
 		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Release|Win32.ActiveCfg = Release|Win32
 		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Release|Win32.Build.0 = Release|Win32
+		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Release|x64.ActiveCfg = Release|x64
+		{1132A142-F8A1-4464-881C-7F50D77A1CD2}.Release|x64.Build.0 = Release|x64
 		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Debug|Win32.Build.0 = Debug|Win32
+		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Debug|x64.ActiveCfg = Debug|x64
+		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Debug|x64.Build.0 = Debug|x64
 		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Release|Win32.ActiveCfg = Release|Win32
 		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Release|Win32.Build.0 = Release|Win32
+		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Release|x64.ActiveCfg = Release|x64
+		{F4B8B6F3-8198-4FC3-92A3-C944644B570A}.Release|x64.Build.0 = Release|x64
 		{CE7334CB-F82B-4F29-8648-D959871BBC71}.Debug|Win32.ActiveCfg = Debug
 		{CE7334CB-F82B-4F29-8648-D959871BBC71}.Debug|Win32.Build.0 = Debug
+		{CE7334CB-F82B-4F29-8648-D959871BBC71}.Debug|x64.ActiveCfg = Debug
 		{CE7334CB-F82B-4F29-8648-D959871BBC71}.Release|Win32.ActiveCfg = Release
 		{CE7334CB-F82B-4F29-8648-D959871BBC71}.Release|Win32.Build.0 = Release
+		{CE7334CB-F82B-4F29-8648-D959871BBC71}.Release|x64.ActiveCfg = Release
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
Index: vcnet/config.h
===================================================================
--- vcnet/config.h	(revision 1736)
+++ vcnet/config.h	(working copy)
@@ -70,7 +70,9 @@
 #undef HAVE_GNUTLS
 #undef HAVE_LIBSSL
 #define HAVE_SSPISSL
-#define HAVE_SSL
+/*
+ #define HAVE_SSL
+*/
 
 
 /*
@@ -136,8 +138,10 @@
  * Do we have the long long type?
  */
 
-#undef HAVE_LONG_LONG
+/* #undef HAVE_LONG_LONG VS2013 has this */
 
+#define HAVE_LONG_LONG 
+
 #ifdef HAVE_LONG_LONG
 #  define HTMLDOC_LLFMT		"%lld"
 #  define HTMLDOC_LLCAST	(long long)
@@ -151,7 +155,8 @@
  * Do we have the strtoll() function?
  */
 
-#undef HAVE_STRTOLL
+/* #undef HAVE_STRTOLL VS2013 has this */
+#define HAVE_STRTOLL
 
 #ifndef HAVE_STRTOLL
 #  define strtoll(nptr,endptr,base) strtol((nptr), (endptr), (base))

@michaelrsweet michaelrsweet added the bug Something isn't working label Mar 3, 2017
@michaelrsweet michaelrsweet added this to the Stable milestone Mar 3, 2017
@michaelrsweet michaelrsweet added enhancement New feature or request and removed bug Something isn't working labels Mar 16, 2017
@michaelrsweet michaelrsweet modified the milestones: Future, Stable Mar 16, 2017
@michaelrsweet
Copy link
Owner Author

Might consider supporting the style attribute and width/height properties instead, otherwise the HTML input won't be valid...

@birdwes
Copy link

birdwes commented May 3, 2017

Hi Michael,

The reason I implemented in my local copy this was for compatibility with Internet Explorer print templates as described here: . I use an embedded IE as an engine to print the page if there is no email address. If there is an email address, it is converted to PDF and sent. Internet Explorer accepts "in","mm","px" etc, even though it is not really standards compliant.

Thanks for your good work.

Iain W. Bird

@birdwes
Copy link

birdwes commented May 3, 2017

@michaelrsweet
Copy link
Owner Author

Yeah, well I do want to keep things standards-compliant as much as possible, particularly as I implement support for EPUB which requires strict XHTML conformance...

Like I said, I'm considering adding support for things like:

<img style="width: 4in; height: 3in;" src="..." ...>

to override the normal browser width/PPI calculations and remain standards-compliant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority-low
Projects
None yet
Development

No branches or pull requests

2 participants