ite

web项目PDF导出---freemarker 与 ITextRenderer--加页码

南笙酒味 提交于 2019-12-03 18:58:50
最近项目中又遇到pdf导出的需求,以前一直都是用phantomjs-2.1.1-windows.exe插件做的pdf导出,运用插件优点是直接可以把html页面直接转换成pdf导出,缺点是它需要安装,windows、linux、mac等环境下需要的插件安装都不一样,中文字体还需要单独安装;查询了一些文档后就决定采用freemarker 与 ITextRenderer来实现了;偶然间在git看到了 flying saucer 项目;发现思路基本一致就在其基础上开发了(^_^) 。 freemarker 模板能很好的支持html、css样式;但是运用之前需要小小的学习一下freemarker ftl模板的一些固定语法,这对一般的开发者而言应该都没什么难度(^^)。 下面记录一下用到的方法与运用freemarker 与 ITextRenderer过程的一些坑 ftl模板中中文字体显示 ftl模板中静态资源引入 ftl模板中img显示 @RequestMapping( "/createPdf/{corpid}" ) public ResponseEntity<byte[]> createPdf(@PathVariable(value= "corpid" ) String corpid,HttpServletRequest request) throws Exception { Map<

Creating List in z3 using function

匿名 (未验证) 提交于 2019-12-03 10:24:21
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to convert this piece of pseudocode to SMT-LIB language, but I got stuck. List function my_fun(int x) { list = nil for(i in 1 to x): if(some_condition_on_i) list.concat(i) return list } what I've done so far is this: (declare-const l1 (List Int)) (define-fun my_fun ((x Int)) (List Int) (forall ((t Int)) (ite (and (some_condition_on_t) (< t x)) (insert t l1) l1 ) ) ) ) which I know it is wrong, and does not work. can you help me to understand how can I do this? 回答1: SMT-LIB models logic, where variables are always immutable; your

set容器与map容器的简单应用

倾然丶 夕夏残阳落幕 提交于 2019-12-03 10:18:24
set容器中一些函数,取自百度其他大佬已总结好的,如有侵权,请联系删除! set的各成员函数列表如下: c++ stl容器set成员函数:begin()--返回指向第一个元素的迭代器 c++ stl容器set成员函数:clear()--清除所有元素 c++ stl容器set成员函数:count()--返回某个值元素的个数 c++ stl容器set成员函数:empty()--如果集合为空,返回true c++ stl容器set成员函数:end()--返回指向最后一个元素的迭代器 c++ stl容器set成员函数:equal_range()--返回集合中与给定值相等的上下限的两个迭代器 c++ stl容器set成员函数:erase()--删除集合中的元素 c++ stl容器set成员函数:find()--返回一个指向被查找到元素的迭代器 c++ stl容器set成员函数:get_allocator()--返回集合的分配器 c++ stl容器set成员函数:insert()--在集合中插入元素 c++ stl容器set成员函数:lower_bound()--返回指向大于(或等于)某值的第一个元素的迭代器 c++ stl容器set成员函数:key_comp()--返回一个用于元素间值比较的函数 c++ stl容器set成员函数:max_size()--返回集合能容纳的元素的最大限值 c++

MVVM binding command to contextmenu item

匿名 (未验证) 提交于 2019-12-03 09:06:55
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to bind a command to a menuitem in WPF. I'm using the same method that's been working for all my other command bindings, but I can't figure out why it doesn't work here. I'm currently binding my commands like this: Command = "{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.MyCommand}" This is where it goes wrong (this is inside a UserControl) ... The first command binding works like it should, but the second one refuses to do anything. I've tried changing the ancestor

Adding external images to PDF using iText

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having trouble figuring out how to add an external image (referenced by a URL) to a PDF using iText. Is this kind of thing possible? The PDF spec in 7.1.5 says you should be able to reference a PDF via a URL by using a URL specification. This is what I've got so far: PdfFileSpecification pdfSpec = PdfFileSpecification.url(writer, "http://www.someurl.com/test.jpg"); StringBufferInputStream sbis = new StringBufferInputStream(""); PdfStream dict = new PdfStream(sbis, writer); dict.put(PdfName.FILTER, PdfName.DCTDECODE) dict.put(PdfName.TYPE

TypeError: 'NoneType' object is not iterable in Python

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: What does error TypeError: 'NoneType' object is not iterable mean? I am getting it on this Python code: def write_file ( data , filename ): #creates file and writes list to it with open ( filename , 'wb' ) as outfile : writer = csv . writer ( outfile ) for row in data : ##ABOVE ERROR IS THROWN HERE writer . writerow ( row ) 回答1: It means "data" is None. 回答2: Code: for row in data: Error message: TypeError: 'NoneType' object is not iterable Which object is it complaining about? Choice of two, row and data . In for row in data ,

How to keep original rotate page in itextSharp (dll)

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i would like create the project, reading from Excel and write on pdf and print this pdf. From Excel file (from cell) read directory where is original pdf on computer or server, and next cell have info what write on the top in second pdf. And problem is here, original pdf is horizontal, landscape, rotate and my program create copy from original pdf and write info from excel on the top on copy pdf file. But pdf which is landscape is rotate for 270 deegres. This is no OK. For portrait rotation working program OK, copy OK and write on the top of

Python: Appending items to lists by iterating through list of lists

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm a Python newbie crossing over from C. I'm basically trying implement logic equivalent to an array of array pointers in C. I want to append one item to the ends of a bunch of lists by iterating over a list of these lists. I have the following code: data = [10, 20, 30] list1 = list2 = list3 = list() lists = [list1, list2, list3] for i in range(len(data)): lists[i].append(data[i]) for lst in lists: print lst It's result, however, is: [10, 20, 30] [10, 20, 30] [10, 20, 30] instead of: [10] [20] [30] I can't explain why this code fails to

The trait bound `futures::Future&lt;Item=Arc&lt;T&gt;, Error=Box&lt;Error + Send&gt;&gt;: Send` is not satisfied

匿名 (未验证) 提交于 2019-12-03 01:42:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following (simplified) code snippet and I'm trying to run a future on a CpuPool: use futures::{self, Future, IntoFuture}; use std::error; use futures_cpupool::CpuPool; pub struct Store<T: 'static + Send + Sync> { inner: Arc<StoreInner<T, C, SerDe, P>>, } struct StoreInner<T: 'static + Send + Sync> { read_thread_pool: CpuPool, } impl<T: 'static + Send + Sync> Store<T> { pub fn get(self, obj_id: String) -> Box<Future<Item = Arc<T>, Error = Box<error::Error + Send>>> where T: for<'de> BinaryDeserialize<'de>, { let latest_version_id =

Obtain input_array and output_array items to convert model to tflite format

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: PS. Please dont point me to converting Keras model directly to tflite as my .h5 file would fail to convert to .tflite directly. I somehow managed to convert my .h5 file to .pb I have followed this Jupyter notebook for face recognition using Keras. I then saved my model to a model.h5 file, then converted it to a frozen graph, model.pb using this . Now I want to use my tensorflow file in Android. For this I will need to have Tensorflow Lite, which requires me to convert my model into a .tflite format. For this, I'm trying to follow the